Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Still Having Probs With Select Statement Where Date = Todays Date


Hi Guys

I am using vb6.0 connecting to a SQL database (runningMSDE)

I am trying to load all contacts where the recontactdate is today
I have tried the following but am getting the error - syntax error converting datetime to character string - please help!

my code -
onload - dtpicker1.value = date
(tblcontacts.dtmrecontactdate is date/time)

Set adoduecallbacks = New Recordset

adoduecallbacks.Open "Select * from tblcontacts where dtmrecontactdate = ' " & DTPicker1.Value & "%" & " ' ", db, adOpenStatic, adLockOptimistic

- Please help!!!

Thanks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Checking For Date In Access File And Compairing It To Todays Date...
Hey all, i am stuck at this point in my program.

I need the program to load up my access table and check for the date of orders:

each record has a field called PickUp and its formatted like "sat 1/1/2004".

When the form loads up, i need it to check that field and the computers date and if its the same, place the record into the list view. Keep going down the list til EOF.

Any help would be great.

Thanks for your time,
David

Resolved -How Do I Get Tomorrows Date From Todays Date And Put It In Access An Query?
I figured this much out in VB but it returns a string. So how can I put in a Access query tomorrows date? I also want to do a report that is for the week. Do Date$ = 7 days... Any ideas on how I should do this?

Str(Month(Date$)) + "/" + Str(Day(Date$) + 1) + "/" + Str(Year(Date$))

Problem With SQL Date Query (Todays Date)
Hi there,

Having a problem getting an SQL query to work when searching a database for todays date (basically a reminder package).

Here's the query

Set MyRecSet = MyConn.Execute("SELECT CoxRef, CompanyName, ContactName, postcode, tel FROM Reminders WHERE ReminderDate = #(date)# ")

Have tried all sorts of different things such as '&(date)&'") etc.

Only works when I type the date in like so .. WHERE ReminderDate = 15/02/2005

Any ideas please ?

Seymour

Compair Todays Date To A Date On File
Code:
Public Sub CheckExpire()
sb.Panels(1).Text = "Checking For Expired Membership!"
Dim B
Dim A
B = 1
A = 1
Do
If sb.Panels(2).Text = list.TextMatrix(B, 5) Or sb.Panels(2).Text > list.TextMatrix(B, 5) Then
  If list.TextMatrix(B, 1) = "" Then
    Exit Do
  Else
    Form2.Show
    Form2.list.TextMatrix(A, 1) = list.TextMatrix(B, 1)
    Form2.list.TextMatrix(A, 2) = list.TextMatrix(B, 2)
    Form2.list.TextMatrix(A, 3) = list.TextMatrix(B, 3)
    Form2.list.TextMatrix(A, 4) = list.TextMatrix(B, 4)
    Form2.list.TextMatrix(A, 5) = list.TextMatrix(B, 5)
    Form2.list.TextMatrix(A, 6) = list.TextMatrix(B, 6)
    B = B + 1
A= A + 1
   End If
  Else
  B = B + 1
End If

Loop
A = A - 1
sb.Panels(1).Text = "Check Complete, " & A & " Found To Be Expired!"

End Sub

Humm? 0 Found, I Added 1 With A Expired Date, Ideas?




Edited by - catacomb on 8/29/2003 11:00:16 AM

Date And The SELECT Statement
Sub FilterByDate1_click()
Dim Filter as date
Filter=inputbox("Enter Date of Transaction","","")
with Data1
.recordsource="Select * from Table1 where [Date1] = " & Filter
.refresh
end with
end sub
The program is designed to ask the user to enter a date into variable Filter using the Inputbox. The entered date (Filter) is then used in the SQL Select statement to filter Table1. That is, only records with [Date1]= Filter will populate Data1.

When I run the above, a "Too few parameters. 1 expected" error occurs. I believe I have a syntax error (probably something missing). Please take note that Filter is a Date variable and [Date1] is a Date/Time field in the Access Table.

HELP!

Using Date Function In Select Statement
How would I write a select statement to return only records that have the current month in a date field. In other words,

SELECT *
FROM datafare
WHERE jdate ........?? is between the beginning of the current month and now??

Select Most Recent Date Statement?
I want to select customer information from a table based on the most recent date...i.e there is customer info such as balance based on customer number in the table but the customer's balance is updated often so therefore there are a number of records based on a customer number and its balance. The newest balance being that with the most recent record but when i select this information and bring it back to a datagrid it brings back all records. I just want the most recent one for that customer nmber. I have tried usin MAX(date) but this doesnt work for some reason. Any ideas, Please help. important project

Go To Todays Date Row
Hi-

I was wondering if anyone could help me write a macro that when clicked on would take the user to todays date.

My spreadsheet is set up with every date from now until 2010 on the left column.

I want a feature where you click on a button an it takes you to (maybe even highlights that row) the current date.

Any help would be appreciated. I have never used VB or macros before.

thx

matt

Todays Date
is there a way to have a caption display todays date?

Select Statement With A Date/Time Field
Howdy!

I want to pull all records from earlier than 2 two days ago.
I am using Access97,with a Date/Time field, but I can not get the thing to work.

Here's what I have

Dim TimeLapse
Dim SQL

TimeLapse = Now - 2

Set adoMasterRS = New Recordset

SQL = "Select * from Master where RowUpdate >= '" & TimeLapse

adoMasterRS.Open SQL, db, adOpenStatic, adLockOptimistic


Thanx

How Do I Insert Todays Date Using Sql
I have an access table and I want to insert today's date into one of the field. What is the correct syntax.
This is not working:
Dim todaysdate as String
todaysdate = format(Now,"m/d/yy")
Insert into table(Date)Values(todaysdate)
Thanks

Doesn't Seem To Like Todays Date
Am I missing something?

CODEMe.MyDay.text = Day(date)

Sql Select Statement Syntax Involving Date/time.
i need to query the date and time of a field in a db. the date i get from a datepicker, and the time i need to specify myself.
what is the syntax?

>= " & "'" & Format(DTPFrom.Value, "yyyy/MM/dd") & "'" & ") AND " _
this is what the line looks like right now. now i need to add the time 00:00:00 to this date.

for example
>= " & "'" & Format(DTPFrom.Value, "yyyy/MM/dd") 00:00:00 & "'" & ") AND " _

how do i get it to accept it? all these appostrophes and stuff make me wanna die

List ALL Files For Todays Date
Hi,

Can someone please help me with the following request.

I wish to list all file names on my hard disk that have a last accessed/modified date of today - this includes all subdirectories
from the root directory.

Thanking you in advance.

Cheers,

Kevin

Saving Textbox With Todays Date
I am trying to save the text in a textbox with the with the current date automatically updated every day by simply clicking a button

This is what I have but it doesnt work

visual basic code:--------------------------------------------------------------------------------Public Function SaveText(Text1 As TextBox) As Boolean
Dim hFile As Integer
Dim sFileName As String

On Error Resume Next
hFile = FreeFile
sFileName = App.Path & "C:" & Format(Now, "yyyymmdd") & ".txt"
Open sFileName For Output As #hFile
Print #hFile, Text1.Text
Close #hFile
End Function

Private Sub Command1_Click()
Call SaveText(Text1)
End Sub

Private Sub Text1_Change()

End Sub
--------------------------------------------------------------------------------

Adding Days To Todays Date
I want to add x amount of days to todays date. The number of days is held in an integer variable...how would i do it????

Inserting Todays Date With Button
I am v new to this VBA lark so be kind :-)

I have three cbo's - dd, mm, yyyy and what I want is a button next to the date dropdowns so you can click 'today' and it fills out the dd/mm/yyyy with todays dates.

I currently have this cbo code :-

    With cbodd
      .AddItem "01"
.............
      .AddItem "31"
    End With
    With cbomm
      .AddItem "January"
.............
      .AddItem "December"
    End With
    With cboyyyy
      .AddItem "2004"
.............
      .AddItem "2008"
    End With

Any help/pointers very welcome!

Thanks

Pete




Edited by - petebrooker on 6/22/2004 10:10:00 AM

Saving Text With Todays Date
I am trying to save the text in a text box as for example "20050511.txt" for todays date. I want the date to update automatically and I want the file to save when I click a command button.

Please help if you can

Reading Todays Date / Display Data
I'm writing a small address program and wish that it will display a list of birthdays/anniversaries that are happening 'today' when the form loads.

As I have the control version of VB I am unable to read from a database, so I thought that I would just list them - but can I get VB to read a list and recognise 'todays' date?

A direct to research would be helpful, Cheers

Creating A Text File With Todays Name And Date
Question:how to create a text file with the name of the file being today's date and time

FIXED!!! Display Todays Date <Access>
< edit > I got it working...

How do assign today's date to a text box? I tried searching around here before posting a simple question.

Here is what I have:

Code:
Private Sub order_date_BeforeUpdate(Cancel As Integer)
    order_date.Value = Date
End Sub




Edited by - SubPar_Coder on 9/15/2004 3:00:46 PM

Monthview DayBold Works, But Resets To Todays Date.
This is a pretty easy task I think, but I wanted to run this by everyone on the forum.

My program revolves around a monthview control. The user clicks the date they want to work with and off they go. What I'd like to do is have the monthview control show the days in bold where data has been entered into the database. That way the user can see at a glance (one month at a time) where they've entered data.

I think the easiest way to do this is to find the first and last day of the month their working in then run a query that selects distinct dates from the database where they fall in between the first and last days of the month. At that point I can loop through and say if there is a match, bold the day...if not, move to the next day.

So I guess all I need is how to find the first and last days of a month based on where the user is currently sitting in the monthview control.

Q.1 - Adding Todays Date To The Write File When Saving And Q.2 - Appending
I would like to know if I could add a statement to the write command somewhere in the following code, so the file would write Todays date at the end in date format MM/DD/YY:

As the text in my write file looks like this:

"Flower - Lilac",2,5.22,10.44

Could I get it to add TODAYS date automatically to read

"Flower - Lilac",2,5.22,10.44,03/07/04

My code now reads:

**************************************************
Private Sub cmdWriteQuotation_Click()
    Dim pintCurrentItem As Integer
    Dim pstrFileName As String
    Dim psngTotal As Single
   
    
    pstrFileName = _
        InputBox("Enter the filename", "Write File")
    If pstrFileName <> vbNullString Then
        Open pstrFileName For Output As #1
        For pintCurrentItem = 0 To _
            lstQuotedExtPrice.ListCount - 1
            Write #1, _
                lstQuotedProduct.List(pintCurrentItem), _
                Val(lstQuotedQty.List(pintCurrentItem)), _
                Val(lstQuotedPrice.List(pintCurrentItem)), _
                Val(lstQuotedExtPrice.List(pintCurrentItem))
        Next
    
    psngTotal = 0
    For pintCurrentItem = 0 To _
        lstQuotedExtPrice.ListCount - 1
        psngTotal = psngTotal + _
            lstQuotedExtPrice.List(pintCurrentItem) * 1.06
        ' Above line computes Sales Tax directly into total
       

    Next
    txtTotal.Caption = Format(psngTotal, "Currency")
   

End If
        Close #1
    
End Sub
****************************************************
Also, when I pull this data into an Access Table it leaves the .44 off the total price of 10.44 as from the line below: why?

"Flower - Lilac",2,5.22,10.44 (It pulls the 5.22 just fine, but the 10.44 it gives me 10)


Also someone told me how to append the write file here earlier by using the Append command with the For statement, but can't get that to work...could someone give me a clue how to change this Statement to append all new input to the same text file.

My existing code is above and if you can show me how to use the append command I'd sure appreciate this too...

Thank you
NMP

Archive PPT-Save A Copy With Todays Date, If Doesnt Exist Already
I want to make a macro that will check a certain directory for a file with a filename like:

Presentation-20-09-2007.ppt

If the file for todays date doesnt exist, it saves the current presentaion with the proper date in the filename.

Is that possible?

Date Probs
I have this code:

Code:
Private Sub next_cal()
Dim b As Variant
Dim D As Variant
Dim C As Variant
Dim t As String
Dim month As Long
Dim year As Long
Dim day As Long
If DTPLastCal = "1-1-1601" Then
e = "1-1-1900"
Else

datum = DTPLastCal.Value
day = DatePart("d", datum)
month = DatePart("m", datum)
year = DatePart("yyyy", datum)

b = CDate(DTPLastCal.Value)

C = Val(txtCalibFreq.Text) Mod 12
D = Val(txtCalibFreq.Text) / 12 - C / 12
year = year + D

If month + C > 12 Then
month = month + C - 12
year = year + 1
Else
month = month + C
End If
If month = 2 And day - 28 > 0 Then
month = month + 1
day = day - 28
End If
Dim DAG As Long
DAG = day - 31
If (month = 4 Or month = 6 Or month = 9 Or month = 11) And DAG > 0 Then ' day - 31 > 0 Then
month = month + 1
day = day - 31
End If

e = day & "-" & month & "-" & year

End If
DTPNextCal.Value = e
End Sub

I force my dates into "dd-mm-yyyy" format


Code:
Private Sub Format_Date()
DTPAddEntryDate.Format = dtpCustom
DTPAddEntryDate.CustomFormat = "dd-MM-yyyy"
DTPAddEntryDate.Value = Now

DTPLastCal.Format = dtpCustom
DTPLastCal.CustomFormat = "dd-MM-yyyy"
DTPLastCal.Value = Now
DTPNextCal.Format = dtpCustom
DTPNextCal.CustomFormat = "dd-MM-yyyy"

DTPAddDSC.Format = dtpCustom
DTPAddDSC.CustomFormat = "dd-MM-yyyy"
DTPAddDSC.Value = Now
End Sub
it is designed to return the date of the next calibration given the date of the last calibration and the calibrationinterval or calibrationfrequency (once a year) in months.

The problem is this (suppose LastCal is 5-1-2005 and the calibration interval is 12 months):
on two PC's I get this:
LastCal: 5-1-2005 --> NextCal: 1-5-2006
LastCal:12-1-2005 --> NextCal: 1-12-2006
LastCal:13-1-2005 --> NextCal: 13-1-2006

On my VB PC (the one I wrote the programme with):
LastCal: 5-1-2005 --> NextCal: 5-1-2006
LastCal:12-1-2005 --> NextCal: 12-1-2006
LastCal:13-1-2005 --> NextCal: 13-1-2006

So can anybody tell me where to look for the solution

HELP!! I just demonstrated this on one of the two PC's and it did it's math correctly!! 1-1-2005 + 12 month = 1-1-2006

Could this be a declaration problem? I've heard about discrepancies when it comes to the types "date" and "integer" and "string" see this link to see what I mean

Date Causing Probs In SQL Cn String
Hi all
I have a string:

Code:
.Open "SELECT * FROM Results WHERE RecordDate = '" & Date & "';", _
cn, adOpenKeyset, adLockPessimistic, adCmdText


That throws error:


Quote:




Run-time error '-2147217913 (80040e07)':
Data type mismatch in criteria expression.






I tried formatting the db field to different types of date/time and the vb date value to short, long and medium date etc, no luck.

am I even seeing the right thing? if any suggestions, much appreciated.
Thanks all.

Crystal Report Date Probs
hi,

i'm using crystal report 7. the probs i'm facing is that all my reports run perfect on most of the machines but on few machines date format in them gets disturbed. i've checked the system date format also.

thanks.

Saving A Text Box As Text With Todays Date
Does anybody have any idea on how to automatically save a text box as text with the file name as todays date.

thanks

DATE Problems - Change Date Format To European, Get Current Date, Subtract 2 Dates?
Need someone to point me in the right direction/start me off with this please as I am quite clueless on it at present...

I need something that can successfully subtract two dates...


eg. calculate the difference between the current date
02/04/04 (2nd April 04) and 29/03/04 (28th March 04)
...
which will then output a result of 5 days


So what I need to know is...

1.
I need to know how to get the current date from the system clock

2.
I must somehow get my date function converted into European date format (as at present it is in USA format ie. 2nd April 04 is 04/02/04 like April 2nd 04 which is not good!)

3.
and then I must actually SUBTRACT the 2 dates (the current date and a date that is given) from each other to give an integer which I can then use (ie. a value like 5 or 15).


But I have little idea how to go about this


Can anyone please start me off?

DATE Problems - Change Date Format To European, Get Current Date, Subtract 2 Dates?
Need someone to point me in the right direction/start me off with this please as I am quite clueless on it at present...

I need something that can successfully subtract two dates...


eg. calculate the difference between the current date
     02/04/04 (2nd April 04) and 29/03/04 (28th March 04)
     ...
     which will then output a result of 5 days


So what I need to know is...

1.
I need to know how to get the current date from the system clock

2.
I must somehow get my date function converted into European date format (as at present it is in USA format ie. 2nd April 04 is 04/02/04 like April 2nd 04 which is not good!)

3.
and then I must actually SUBTRACT the 2 dates (the current date and a date that is given) from each other to give an integer which I can then use (ie. a value like 5 or 15).


But I have little idea how to go about this


Can anyone please start me off?

Every Record Has A Date Field. I Want To Find A Date And From This Date, I Want To Read Records To E
Every record has a date field. I want to find a date and from this date, I want to read records to eof. What is the code? - Thanks

DATE Problem - Formatting US Date MM/DD/YY To European Date Format DD/MM/YY
I have a problem whereby the user must enter a date into a field...

The system changes the date format to US standard which is MM/DD/YY
but I need to change the format to DD/MM/YY (European standard)


I have done this using the Format function, but I still have a slight problem
Format(mydate,"dd/mm/yy")

doesnt account for all dates...

for example...
if I enter 31/03/04 this is fine, it will accept it as that

However, if I enter 02/04/04 (todays date - 2nd April 04), it will change it to 04/02/04



Any ideas how I can counter this from happening?

Query With Date Ranges And Return Only Closest Date To 'to Date'
I am using an access db...

I am trying to pull back due dates for credit reports for clients. I have 4 tables I am working with for this query...

    [Client_info]
    [Dispute_track_eq]
    [Dispute_track_exp]
    [Dispute_track_trans]

[Client_info] has the basic client information....ID, SSN, name, telephone_numbers, yadd yadda..
    each of the other tables hold the fields I am pulling from(other fields as well but these are the ones i need)...

    [Dispute_track_eq].eq_due_date
    [Dispute_track_exp].exp_due_date
    [Dispute_track_trans].trans_due_date

Here is my problem...
    I have variable that are set by dtpickers...'from_date' and 'to_date'. I am trying to get back each of these due dates that fall between the ranges set along with the [client_info] data linked by the SSN field. The problem is that sometimes these clients will have multiple due_dates(multiple rows) between the range. What the end result needs to be is this, I need to only have one record to come back with one of each due_date from each table, but only give me back the closest due_date to the 'to_date'(set by dtpicker) as well as the data from the [Client_info] table. And if there are no records for one or two but not the thirs field, an empty fields is ok(using a datagrid). But I can only pull back one row with the [client_info] fields, and one of each of the 3 due date fields. I have a query already but it doesnt even come close to working, it gives me many duplicates and doesnt give me the closest due_date to the 'to_date'.

Here is my query, but it doesnt work. Any help would be greatly appreciated, I am in dire need of help on this one.

Code:Private Sub Command4_Click() '***Due dates report grid date
    to_date = dt2.Value
    from_date = dt1.Value
    If from_date = vbNull Then
            MsgBox "Please select a FROM DATE"
            Exit Sub
        ElseIf to_date = vbNull Then
            MsgBox "Please select a TO DATE"
            Exit Sub
    Else
    Dim ID_new As String
    Dim cn As ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim strSQL As String
    Dim ID_pass As String
    Dim active As String
    
    active = "Active-Negotiations"
   
    Set rs = New ADODB.Recordset
    
    
        strSQL = "Select" & vbNewLine
        strSQL = strSQL & " [client_info].[FirstName], [client_info].[LastName], [client_info].[HomePhone], [client_info].[MobilePhone], [client_info].[Client_status], [client_info].[Category], [client_info].[Appt_notes],[client_info].[Appt_date],[client_info].[Appt_date_time], " & vbNewLine
        strSQL = strSQL & " [dispute_track_eq].[eq_due_date], [dispute_track_exp].[exp_due_date], [dispute_track_trans].[trans_due_date]" & vbNewLine
        strSQL = strSQL & " FROM (dispute_track_exp INNER JOIN (dispute_track_eq INNER JOIN client_info ON [dispute_track_eq].[SSN] =[client_info].[SSN]) ON [dispute_track_exp].[SSN] =[client_info].[SSN]) INNER JOIN" & vbNewLine
        strSQL = strSQL & " dispute_track_trans ON [client_info].[SSN] =[dispute_track_trans].[SSN]" & vbNewLine
        strSQL = strSQL & " Where (dispute_track_trans.trans_due_date > #" & from_date & "# And" & vbNewLine
        strSQL = strSQL & " dispute_track_trans.trans_due_date < #" & to_date & "#)" & vbNewLine
        strSQL = strSQL & " OR (dispute_track_eq.eq_due_date > #" & from_date & "# And" & vbNewLine
        strSQL = strSQL & " dispute_track_eq.eq_due_date < #" & to_date & "#)" & vbNewLine
        strSQL = strSQL & " OR (dispute_track_exp.exp_due_date > #" & from_date & "# And" & vbNewLine
        strSQL = strSQL & " dispute_track_exp.exp_due_date < #" & to_date & "#) AND NOT NULL"


    Set cn = New ADODB.Connection
    With cn
           .Provider = "Microsoft.Jet.OLEDB.4.0"
           .ConnectionString = "Data Source= " & db & " "
           .open
    End With
    
    Set rs = New ADODB.Recordset
    With rs
        .ActiveConnection = cn
        .CursorLocation = adUseClient
        .CursorType = adOpenStatic
        .Source = strSQL
        .open
    End With
        
        If rs.RecordCount = 0 Then
            MsgBox "Sorry, no one matched that status, try again", vbOKOnly, "Credit Matrix"
            Set DataGrid1.DataSource = rs
        Else
            Set DataGrid1.DataSource = rs
    
        End If
        End If

    I would be forever in your debt for helping me as I am almost out of hair....FROM PULLING IT OUT!!
    



Edited by - ronmegga on 4/1/2004 5:26:03 PM

DATE Problem - Formatting US Date MM/DD/YY To European Date Format DD/MM/YY
I have a problem whereby the user must enter a date into a field...

The system changes the date format to US standard which is MM/DD/YY
but I need to change the format to DD/MM/YY (European standard)


I have done this using the Format function, but I still have a slight problem
Format(mydate,"dd/mm/yy")

doesnt account for all dates...

for example...
if I enter 31/03/04 this is fine, it will accept it as that

However, if I enter 02/04/04 (todays date - 2nd April 04), it will change it to 04/02/04



Any ideas how I can counter this from happening?

Grouping By Date Where Date Field Is Date/time
I have an SQL7 database storing datetime data, and totaliser reading, new records are added every 5 minutes.

I have written the following sql to give me the the min and max totaliser reading for each day - which works fine - except that the resultant Date field is a text field not a date field so the order statement generates an incorrect listing if the data selected sarts in one month and ends in the next, eg.

select left(Date, 12) as Date, Min(Reading) as Day_Start, Max(Reading) as Day_End from Steam where tag_no = 2 and (Date <= '24-November-2005 00:00:00' and Date >= '22-October-2005 00:00:00') Group By left(Date, 12) order by Date asc

Is there another function I can use to extract just the date from the date/time field as a date data type?

I cannot alter the database as its structure is predetermined by the remote field device supplying the data.

SQL Statement (Date)
I want to sum selected records that meet the criteria (year) as below:

strSQL = "SELECT SUM(Charge) as ChargeThisYear from TREATMENT where year(Date_Treatment) = #" & Year(Date) & "#"

That SQL statement give me syntax error. I know the problem lies on the date. If I change to Date_Treatment = #" & Date & "# then OK. Actually I want VB to sum in a Year .

Thank you... Raymond

Using Date In SQL Statement
I want to do an SQL statement on a table to retrieve the records for todays date. There is a field in the table called strDate which I have set to Date/Time and Short Date. The records go in fine with the correct date going in, but then when I do my SQL statement to pull out all records for todays date I get a data type mismatch, using

"SELECT * FROM tblDetails WHERE [tblDetails].strDate = '" & Date & "'"

Date is the system date and when I look at the system date and that in the databse they are exactly the same, does anyone know what I am doing wrong..

Thanks

Sql Statement Help - Date - Between
im currently using a sql statement;-

DATABASE.RecordSource = "SELECT * FROM tblTenders WHERE (followup between date and (date + 10))"

this seaches for records between two dates ( the above staement works well)but i want to change the seach dates at run time

i tried the sql statement
DATABASE.RecordSource = "SELECT * FROM tblTenders WHERE (due between """ & date1.Text """)and (""" & date2.Text "2"))"

but it says the an error in the statement

can any body help?

Like Statement And Date
I am doing a search in a filterbar format and am attempting to do a filter on a date. The LIKE statement does not seem to work.  Has anyone encountered and overcome this before??

Billy

Help With Date SQL Statement
I've got a MS Access 97 database with fields (in that order):
FieldName        Type
Date        Date/Time
Time        Date/Time
Val1        Integer
Val2        Integer

Now, I'm trying to extract Time, Val1 and Val2 when Date is given as user input. So, I accept the input in a textbox called "txtDate" and then use this SQL : "SELECT [Time],Temp,Pres FROM tblData Where [Date]= " & txtDate.text. I've made sure that the input date is in format dd/mm/yyyy and that the given date exists in the database. Still I get 0 records. Could anybody help me out?

Select Between Date
can friend help to solve this prob,i developed room booking system and want to check whether a range booking date is conflict with another range of booking date.what sql statement or anything i can use .

thanks

SELECT &amp; Date
Hi all,

With this statement......


Code:
sKeuze = "SELECT * FROM orders WHERE datecomplete = 0 "
......I'm trying to select all Orders that have no completion date i.e. where the field "datecomplete" (short date) is empty. However, this doesn't work. The recordset stays empty. I've searched the forum, but haven't found the solution yet.
Does someone have a suggestion?

Thanks in advance,

Wimchester

Help With Date Select
I have a date field like 25/02/2002 'dd/mm/yyyy' ; I would like to extract the month and year so I can build a select statment on them. e.g.

If month is 02 then ...
Select * from table where month = 02
End if

if year is 2002 then
Select * from table where year = 2002
End

The only problem is that my date field in database is one field which is call_date and it is datefield like 'dd/mm/yyyy'.

How can I make the select statment search for only month or only year in that field?

Thank for all of your for your help

Select Date
Is there any ocx control or such that let you select a date like the way you do it in the Outlook calander?

/Anders

SQL Statement Where Date = Cell Value
I know this is probably horribly easy but I've been trying all sorts of syntax with no luck. My question is...How can I make this query:

Db.OpenRecordset("SELECT Batches FROM Production WHERE Date = #09/01/04#

into:

Db.OpenRecordset("SELECT Batches FROM Production WHERE Date = [this is where the correct syntax for a cell would go, like A1 or something]

Any help is greatly appreciated!

Date Comparison In SQL Statement
Well, I'm on a roll for questions today. This database uses things that I haven't even looked at in over a year.
So we're building a query to look up data based on a user ID, a From Date, and a To Date. Here's how I've got the end of the statement set up:

Code:
WHERE [Examiner/Clerk] = '" & strExamNum & "' AND [Date of NF] >= " & strFromDT & " AND [Date of NF] <= " & strToDT & "")
Somewhere along the lines, this isn't working because it's throwing me the EOF/BOF error, even though the items I'm giving it is over 250. The table field for "Date of NF" is set as a "Date/Time" field with no format or input mask. The table data shows as mm/dd/yyyy and I'm entering the data in the same format for the variables. Do I need to use a DateSerial or something for the comparison or am I doing something wrong?

SQL Server Date SQL Statement
Hi there,

I use the following SQL statement to update a record in a Access database:
SQL = "UPDATE ISIN00PF SET " _
& "INDATE = #" & Format(INDATE99, "m-d-yyyy hh:mm AM/PM") & "#, " _
& "INUSER = '" & INUSER99 & "' " _
& "WHERE INBLCD = " & INBLCD99 & " " _
& "AND INEDNR = " & INEDNR99 & " " _
& "AND INJAAR = " & INJAAR99 & ""

This works ok for an Access Database

I got an error when I want to use this statement for an SQL server database.
It occurs because of the date update.
Does anybody know the correct SQL statement for the SQL server database?

Many thanx!!

Date Inside A Sql Statement
is this correct:

select * from table where field<12/12/2001;
or
"select * from table where field=' & datestring & ";"

SQL Statement For Search Date
Hi,
i faced problem to retrieve a certain data from database(access 97). I only want to display a certain record from a date to another date. What SQL statement should i put?
hope u guys can help me, thanks.

Copyright © 2005-08 www.BigResource.com, All rights reserved