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




Comparing A Date Field


I am trying to comapre a date coming from Access with a date value entered by a user.
I noticed that the date being entered by the user is done so via a text box, which stores the value as a String. The field in the database is a date field.
Can I compare these values the way they are, or do I have to move the date field into a string field or vice versa?
The reason I ask is because when the code to compare the dates
runs nothing seems to work.
Here's a generic example.

Lets say FileDate = 01/01/2001
Lets Say PromptDate = "01/01/2001"

If FileDate = PromptDate Then
msgbox " The dates are equal"
Else
msgbox " The dates are not equal"
End If

If this code was in my program, I would always get the message saying "The Dates are not equal"

Is there a way to better compare dates?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Comparing Date Field With Blank Value
Hi

I have a field in my table as LogOutTime and i writing a sql statement as
select * from table1 where LogOutTime=""

if logouttime field is blank then it must fetch those records.

But showing me a date comparision error

Please tell me how can i compare date field if it is null

thanx

Comparing Date Time Stamps Field
I have a date time stamp field in my database. And i need to count calls for one day. So my sql statement looks something like this :
Code:
                Dim bdwsmtCon As New Odbc.OdbcConnection("Driver={MySQL ODBC 3.51 Driver};server=192.168.2.5;port=3306;database=bdwsmt;pwd=knicks24;uid=tmstms;")
                Dim bdwsmtCommande As New Odbc.OdbcCommand
                Dim bdwsmtReader As Odbc.OdbcDataReader
                Dim strSQL As String 'Select statment
                Dim curDate As String 'curDate
                Dim endDate As String 'end string for sql statment
                curDate = startDateTimePicker.Value.AddDays(dblStartDay).ToString("M/d/yyyy")
                endDate = startDateTimePicker.Value.AddDays(dblEndDay).ToString("M/d/yyyy")
                    strSQL = "SELECT Count(*) AS MyCount FROM wab_answers WHERE answerTime > #" & endDate & " 11:59:59 PM# AND answerTime < #" & curDate & " 11:59:59 PM# AND wabScreen=1;"
                    MsgBox(strSQL)
                    bdwsmtCommande = New Odbc.OdbcCommand(strSQL, bdwsmtCon)
                    bdwsmtCommande.Connection.Open()
                    bdwsmtReader = bdwsmtCommande.ExecuteReader(CommandBehavior.CloseConnection)


The error is the # # round my date and time. I tried to use ' ' around them but that just gave me 0 for the count. Any Ideas?

Comparing Field Date With Textbox Visual Basic And Crystal Report
I need select in the crystal report the invoices that have a date equal to the textbox that the user introduces in the screen.
The user introduce the date in format ddmmyyyy
please help me.

Comparing User Inputed Date With File Date
Hi

Can someone please help me out of this....

i'm making the user input the date in a textbox in the same format as the date format of a file's "last modified date". i need to add all those files to a listview whose last modified date is less than or equal to the user input.

Really appreciate it......
Ice

Comparing System Date With Fixed Date
Hi

Back again! (great site - very helpful)

Is it possible to compare the system date with a written date?
I've shown the current date by:

Label1.caption = date

I've a list box which has several dates which the user clicks
on to obtain information for that particular date. These dates I've displayed by just putting them in quotes i.e. "10th April 2001".

Can I check these dates against the system date and disable the choice should the date have passed?

Any help gratefully received

TKS

Ben

Combing Str To Make Date && Comparing Date
I'm running access 2004, vb 6.

I have the user insert the date they wish to check for into 3 txtboxes.

The fields to check in the datebase are
STARTDATE = DATE/TIME - dd/mm/yyyy format
ENDDATE = DATE/TIME - dd/mm/yyyy format

the txtboxes are

txtYear(0,1), txtMonth(0,1), txtDay(0,1)

(each txt is an array)

this is what i tried to use for code..

VB Code:
strStart = intDayStart & "/" & intMonthStart & "/" & intYearStartstrEnd = intDayEnd & "/" & intMonthEnd & "/" & intYearEnd sSQL = "Select * from SHOWENTR where STARTDATE >= #" & Format(strStart, "mm/dd/yyyy") & "#"


it gives me

No value given for one or more requried parameters. when i try to run it.

so how else can i do this?
they need to be able to show all records within a set of 2 dates that the user inputs.

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

Comparing Value With Field In A Table
Hello all,

I hope someone would be of assistance with me on this. I've got some skills with VB, but never used it with Access before.

need help developing the code for this. Access to be precise.

Essentially, i'm taking a value from a form (secifically a drop down menu...dept). I need to take that value and compare it with a table.

The table consists of

Dept Cat DU DI

now, what i need to do is take the value, and compare it with the value under Dept in the table, whenever that value is equal to Dept in the table, i need to take the Cat, DU, and DI, and spit it into my query (that would be ideal), the second option is to put it directly into the form.

Main form looks like

Dept
Cat
Du
DI

So take dept, compare it with dept in table, and spit out the corresponding Cat, DU, DI, into A) my query B) the form.

HELPPPPPPPP!

Pseudo
Take Dept from form
Compare Dept to Dept In Table
Whenever Dept Value = Dept In Table
Take Cat, Du, Di and put it into form or query.

I know how to get the value, but i need assitance with comparing the value with the Dept column in the table.

------

Sorry, maybe i should include more info. What i'm doing is the form has drop down menus

Dept
Cat
DU
DI

My report feeds off of a query, and at the moment, the user has to enter dept, Cat, du, di and then click on my rpt button. What they want to do is, instead of having to go through all the drop down menus, and clicking each and every paramater. They'd like to just click the dept, click on the button, and everything is printed. So all the Cat's, du's and di's are printed. The printing part isn't a problem.

I've notice this is really a great place, from just browsing, hopefully i'll be able to help others in different areas where i have more expertise!

Comparing String With Database Field?
I have a form that has two database connections on it (don't know if this is necessary or not). Anyway, I have a table in my database called tblCID. That table populates a datagrid. When a user selects one row in the datagrid and clicks a command button (Assign), I want to compare the phone number field there to a field in a different table in the database (tblCustomer). Here is the code I am using:


Code:
Dim dgCIDPhone As String
dgCIDPhone = dgCallerID.Columns(2).CellValue(dgCallerID.SelBookmarks(0))
' Parse through code to remove (, ), - and " "
dgCIDPhone = Replace(dgCIDPhone, "-", "")
dgCIDPhone = Replace(dgCIDPhone, "(", "")
dgCIDPhone = Replace(dgCIDPhone, ")", "")
dgCIDPhone = Replace(dgCIDPhone, " ", "")

MsgBox (dgCIDPhone$)

Dim MyConn As ADODB.Connection
Dim MyRecSet As ADODB.Recordset

Set MyConn = New ADODB.Connection
MyConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:progfileprogdatabase.mdb;"
Set MyRecSet = New ADODB.Recordset
MyRecSet.Open "Select * From tblCustomer Where custPhone1 = dgCIDPhone", MyConn, adOpenDynamic, adLockOptimistic

If MyRecSet.RecordCount > 0 Then
MsgBox ("yes")
Else
MsgBox ("no")
End If

When you click the command button, the first message box pops up with the correct phone number (in the correct, delimited format) as what is in the datagrid (which is formatted as "(123) 123 - 1234"). But once you click "OK" on the first message box, you get an error like this:

"Run-time error: '2147217904 (800040e10)':

No value given for one or more required parameters"

I'm totally new to VB and have idea what this means exactly.

I was thinking about running the new query using the same database connection but was afraid that if another call came in while I was working with this database connection that the recordset would reset themselves (if that makes any sense). That is why I went with a separate connection and recordset.

Can anyone suggest what I am doing wrong here? I am hoping that if the phone number (dgCallerID) IS in the tblCustomer, I'll get a "yes" message box. If it's not, then I'll get a "no" message box.

Any idea's??

Thanks ahead of time.

DTFan

Comparing A Field With A Function In ActiveReport
This is a little complicated to explain but here I go anyway:

On an ActiveReport I have to display an "*" (in FldIndicator) if field24.datavalue (a percentage itself) is greater than my GetFiscalYearPercent function (thanks again Hypetia) or "" if not.

Needless to say I can't seem to get it to work.

Note:
field24.datavalue = field21.datavalue/field20.datavalue


I tried:
------------------------
If Field24.datavalue > GetFiscalYearPercent(Date) then
     FldIndicator.datavalue  = "*"
Else
     FldIndicator.datavalue  = ""
End if
-------------------------

Comparing DB Entries Within A Field And Validating Them
Hi,

This may be a little difficult to explain but here goes:

I have a table in access 97 with the field Account. An account name is usually written as 0000000_A, but it MAY also have a secondary account and is usually written with the same first series of digits but ends in B e.g. 0000000_B. Therefore, we could have an account 0023654_A and 0023654_B.

Now for each account name there is another field called Items which are chosen from a combo box on a form (item 1, item 2, item 3, item 4, item 5, item 6, item 7 and item 8). An account may have more than one item.

Now if account B exists then it MUST contain the same entries as account A but can also have additional items.
So we could have a situation where:

0023654_A
item 1
item 2
item 3
item 4
  
0023654_B
item 1
item 2
item 3
item 4
item 5
item 6

Now what I am trying to implement is that if the core items (these are those that are contained in both - which would be item 1, item 2, item 3 and item 4 in the above example) are changed in either accounts making them not equal then a warning message should come up stating so. IT IS IMPERATIVE THAT THE CORE ITEMS ARE PRESENT IN BOTH.

I have some experience in Access 97, but unsure of how to tackle this. Could somebody please guide me ???




Edited by - umairsheikh on 9/25/2005 7:19:13 AM

Comparing SQL Date And Access Date
this is what ive done:

strQuery = "SELECT * FROM Table WHERE Date1 = '%/" &amp; strYear &amp; "'"


ive tried putting #%/" but it gave me a syntax error. my date in Access would be in short date...does it matter? and my output in VB Flexgrid is mm/dd/yy.

PLEASE HELP

Change Date Field To A Text Field Without The Slashes
I have a field called statement date which is a date type "08/21/2008".
I want to remove the "/" from that variable. Is there an easy way to do that?

Comparing Date
Hi all,

i have a access databse table that contain one of the fields dates,

i have written part of the code as this:
Adodc1.ConnectionString = "Provider=Microsoft.jet.oledb.4.0;persist security info=false;data source=" & App.Path & "CarReg.mdb"
Adodc1.RecordSource = "SELECT * FROM Car WHERE Car.CarEntranceDate = #querydate#;"

Adodc1.Refresh

how do i compare the date in the table with the present date?



regard

Date Comparing
hi,
i 'm new to vb. now, i having some same ID records which are needed to do comparison.
ID date
----- -----------
122 5-Jul-2004 20:55:02
122 2-Jul-2004 18:22:08
122 25-Jun-2004 19:50:21


how can i compare these record's date? becausei want to out record with latest date in vb code.

Help Comparing Date In DB
I have a data base set up with fields,
Serial #
Person
Expires

I need to compare the expires column with the current date and return a window to the user with the information from the serial number and the person field if the date is within 7 days.
i know this is goin be simple but i just cant figure it out.

I am greatly appriciating the help.

Comparing No Or Date
Hi there

I need to take minum and Maximum of given number or dd/mm. How i compare the given no.

Example (22/12,01/11,29/05,09/03)

any one can help me in this regards

thanx in advance

by
yasin

Date Comparing
"04/03/2003" > "04/03/2001"

is that a correct way to check if a date is earlier or after the other date? i need to check if something is out of newer than another date.. will this always work? :S

Date Comparing
Hi. I've got this program that needs to update itslef every 2 weeks. I am having trouble figuring out to know when its been 2 weeks exactly.

I know you use the Date function but exactly how do you know when its been 2 weeks.

Right now i'm saving the date to the registry then pulling that info up everytime the Prog loads. If the current date is 2 weeks past the Old date then i do the update thing and write the current date to the registry.


Its not hard as long as the dates are in the same month.. its when then month flips over that i cant figure it out.


Thanks!

Date Comparing
How do you compare two dates? What I need to do is see if one date is older than the other one. Any help is appreciated!

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.

Coding For Comparing The Date
Hi!
is anyway can i compare the effectivedate to today()
if effectivedate = (today(), mmm)
do something
else if effectivedate = (today(), mmm )
the above has syntax error
what acctually, check with today date only month
if it is months are same do somehting
or if effectivedate is previos month and companre with today
do something
how do i put it in vba . thanks for your help

Comparing Date And Time
Hi
I have started learning vb recently,I need some help from u guys.

I am writing a program to maintain the booking of vehicles(for rent),
Here I need to display the available vehicles during specified date and time.
I am using VB6.0,and MSaccess 2000.

In the database i have stored
1) "journeydate & time" and 2) "returndate & time" of all the booked vehicles

I want to compare these "date & time" along with the "date & time" the user selects.

After selecting the journey "date & time" and return "date & time" he should be able
to see the list of vehicles free for that particular interval.

E.g. If vehicle_1 is booked for 1st july/2:00:00PM to 4th july/2:00:00PM
It should be available only after 4th july/2pm or before 1st july/2Pm.

I have written the following code:

If rstrip!Date_Booked < bookingdate And rsdesgn!Date_Return < returndate Then
If rsdesgn!Date_Return > returndate Then
Set rs = New ADODB.Recordset
strrs = "select VehicleRegNo from Vehicle_Details_Master where vehicleid=" & rsvehicle!vehicleid & ""
rs.Open strrs, cn, adOpenDynamic, adLockOptimistic
Me.cbovehicleno.AddItem rs!vehicleregno

End If
Else
If rstrip!Date_Booked < bookingdate And rstrip!Date_Booked < returndate Then
Set rs = New ADODB.Recordset
strrs = "select VehicleRegNo from Vehicle_Details_Master where vehicleid=" & rsvehicle!vehicleid & ""
rs.Open strrs, cn, adOpenDynamic, adLockOptimistic
Me.cbovehicleno.AddItem rs!vehicleregno
End If
End If

This code is working fine for all of the conditions except on the same dates say July 1st before 2PM.

Comparing Two Date Values
Dear Expert

I neet to compair two date value and get respective
values. Same as we use VLookup in Excel. I try to find
a solution from your database but I cound not.

Many Thanks to all of you who give your full suport to
solve our problems.

Comparing Date And Time
Hi
I am a newbie.I need a help.Please help me.

I am writing a program to maintain the booking of vehicles(for rent),
Here I need to display the available vehicles during specified date and time.
I am using VB6.0 and MSAccess2000.

In the database i have stored
1) "journeydate & time" and 2) "returndate & time" of all the booked vehicles

I want to compare these "date & time" along with the "date & time" the user selects.

After selecting the journey "date & time" and return "date & time" he should be able
to see the list of vehicles free for that particular interval.

E.g. If vehicle_1 is booked for 1st july/2:00:00PM to 4th july/2:00:00PM
It should be available only after 4th july/2pm or before 1st july/2Pm.

I have written the following code:

If rstrip!Date_Booked < bookingdate And rsdesgn!Date_Return < returndate Then
    If rsdesgn!Date_Return > returndate Then
        Set rs = New ADODB.Recordset
        strrs = "select VehicleRegNo from Vehicle_Details_Master where vehicleid=" & rsvehicle!vehicleid & ""
        rs.Open strrs, cn, adOpenDynamic, adLockOptimistic
        Me.cbovehicleno.AddItem rs!vehicleregno

     End If
Else
    If rstrip!Date_Booked < bookingdate And rstrip!Date_Booked < returndate Then
         Set rs = New ADODB.Recordset
        strrs = "select VehicleRegNo from Vehicle_Details_Master where vehicleid=" & rsvehicle!vehicleid & ""
        rs.Open strrs, cn, adOpenDynamic, adLockOptimistic
        Me.cbovehicleno.AddItem rs!vehicleregno
         End If
End If

This code is working fine for all of the conditions except on the same dates say July 1st before 2PM.

Comparing Date Values
i want to compare a date from a database with two dates einde and begin
i wan to select the dates in the databse between these two

i already tried this but nothing works!

'adoklacht.RecordSource = " select * from taKlantenKlacht where klachtdatum QOP_DATE_GTE( " & begin & ") and klachtdatum QOP_DATE_LTE( " & einde & ")"
'adoklacht.RecordSource = " select * from taKlantenKlacht where DateValue(klachtdatum) &gt; " & DateValue(begin) & " and DateValue(klachtdatum) &lt; " & DateValue(einde)
'adoklacht.RecordSource = " select * from taKlantenKlacht where klachtdatum QOP_DATE_GTE( " & begin & ") and klachtdatum QOP_DATE_LTE( " & einde & ")"
'adoklacht.RecordSource = " select * from taKlantenKlacht where DateValue(klachtdatum) &gt; " & DateValue(begin) & " and DateValue(klachtdatum) &lt; " & DateValue(einde)
'adoklacht.RecordSource = " select between(klachtdatum," & begin & "," & einde & ") from taKlantenKlacht"
' adoklacht.RecordSource = " select * from taKlantenKlacht where klachtdatum between " & " begin" & " and " & " einde"

can you help me?Please?

Date Picker Control Doesn't Show Current Date In Field
How do I set the display date in the Date Picker control field ? MSDN says that it should return the current date by default, but it only shows the current date highlighted in the drop down calendar.

The control shows the date when the control was created and added to the form.

How do I set the date at form load ?


Code:
dtpicker1.value = ? ' how do I call current date ?

Date Errors While Comparing Sheets
Hi,
I have just started coding in VB Excel. I am comparing two sheets, both with Date and Time Columns. These Col have to match when performing calculations comparing the values for that specific Date and Time.

Except i get numerous repeating TimeENT inputed into the Data Sheet. This happens at Line 31 after it completes one cycle. For example the DateENT&TimeENT would be 01/01/04 & 1:10AM in Line 34,
1 If Range("A" & J) <> DateENT(Count1) And ...
but when it comes down to 44
TimeENT(Count1) = Range("B" & J)
the Time will change to 1:07AM. Essentially going backwards. I can't seem to figure this one out. Let me know if you need more info.
Thank you.

Comparing Date Column Using WHERE Clause
Hello there!

I'm having a problem with regards to comparing date values in WHERE clause, I understand that, in order to compare date values in WHERE clause you have to enclosed date values with # symbol or use DateValue function, my question is, how can i compare (< or >) my date column to a variable or current date?

I wrote this code of statement, pls give me some piece of advice...

Ex.
Dim ddNow as Date
ddNow = date

data1.Recordsource = "SELECT * "
"FROM emp "
"WHERE hiredate < "' & ddNow & "' "

I encountered type mismatch error. How can i add the (#) symbol

I know it has something to do with my ddNow variable.
hope you could help me, thanks alot.....

Retrieving Data By Comparing Date.
Hi! I got to get certain data from the database, selection is based on dates. Using a combo box user can select friscal years " 2002 - 2012"

For Example, When user select friscal year "2002" from the combo box, i need to retrieve data between the dates( dd/mm/yyyy format) 01/06/2002 to 31/07/2003.

My problem is that my boss stores days, months and years in 3 different datafields. how do i code such that the system will know that when i select friscal year "2002" it will retrieve data between the dates 01/06/2002 to 31/07/2003. Thanks

Saving And Comparing Date In Registry
I am looking for a simple program that will compare the current date to a value saved to the registry of the last time my program was accessed.

In other words, I want my program to save the current date into the registry, and compare to the last time this date was saved, and if < than i can terminate the program.

This is probably simple, and I will certainly pass this on if someone can help me out.

Comparing Date Data Types
This is a puzzler to me at the moment. How can I compare a field, which is a date, to the system date? I'm getting a data type mismatch error. If its a string to string comparison you just enclose the variable like so:
'" & variable & "'. I don't know how it is done with date data types. What does the quotes and '&' mean?

Comparing A Date From A File... Having Problems Here &gt;&gt;&gt;
Here is my code .... the problem is that when I have say 8/3/2003 in a file and using the following code on 8/3/2003 it still returns close in text2..

not to mention that but am i crazy or should the < > sign be reversed than to what I have it.... I am trying to say.. if Number is less than date it needs to perform some functions.... but as I said it won't work corectly with the sign the way I think it should be.... am I crazy or is it just to late here?... can someone plug this code in there machine and tell me what you get?... I am pulling my hair out here...

Private Sub Form_Load()
   Open "C:date.txt" For Input As #1


Do While Not EOF(1)
Line Input #1, Number
Loop
Close #1
Date = (Date)

If Number > Date Then
Text2 = "close"
Open "C:date.txt" For Output As #1
Print #1, (Date)
Close #1
End If

End Sub

Need Help Comparing Date Ranges From Access
OK heres my situation ... I am creating a report within a project that pulls specificc records from between two dates. Each date is created with 3 combo boxes the user can select from. I can get my desired records when I hard code the dates in but when I put the dates together and put them into a variable then compare the records in the DB, I dont get any records back. Here is the code that does this function...please help

Private Sub Command22_Click()
    
    Dim ID_new As String
    Dim cn As ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim query As String
    Dim ID_pass As String
    Dim from_date As Date
    Dim to_date As Date

    from_date = Combo1.Text & "/" & Combo2.Text & "/" & Combo3.Text
    to_date = Combo4.Text & "/" & Combo5.Text & "/" & Combo6.Text
    Set rs = New ADODB.Recordset
    
    
    query = "SELECT SSN, FirstName, LastName, HomePhone, MobilePhone, Client_status, Date_joined FROM [client_info]          WHERE ([Date_joined] > '" & from_date & "' AND [Date_joined] < '" & to_date & "' )"

    Set cn = New ADODB.Connection
With cn
       .Provider = "Microsoft.Jet.OLEDB.4.0"
       .ConnectionString = "Data Source= " & App.Path & "db1.mdb"
       .open
End With

Set rs = New ADODB.Recordset
With rs
    .ActiveConnection = cn
    .CursorLocation = adUseClient
    .CursorType = adOpenStatic
    .Source = query
    .open
End With
    
    If rs.RecordCount = 0 Then
        MsgBox "Sorry, noone matched that status, try again", vbOKOnly, "Credit Matrix"
    Else
        Set DataGrid1.DataSource = rs
        

    End If
    
End Sub

Date Comparing Problem [urgent Please.....]
Dear frineds,

I have a serious problem with Microsoft Access at comparing date fields.
the problem is ......

Text1.Text ="10/10/1985" 'i have used dd/mm/yyyy format
data1.RecordSource ="Select * from tb1 where dt < #" & format(Text1,"dd/mm/yyyy") &"#"
data1.Refresh

While i am attempting the above code ..... everithing is fine but the out comming results are wrong. The Comparative operaters are not wroking properely.

I found that the above query is interchaning the month and date values and then comparing when the date is below 12 ( max Months).

any how i am uncertain about the outcomming results.

i have used so many methods like format (),datevalue() functions. And control panel date settings also carefully observed.


........plese help me, my project was hanged due to this problem.

SQL Update Subtracting Date From Date --&gt; Result Into Field
Am having a little trouble with an Update SQL statement.
The code that I have come up with is
strSql = "Update Client_Details SET Client_Details.Days_CTS= " & Date & "- ClientDCTS.M_Date ........

It will come up with the error
Disallowed implicit conversion from data type smalldatetime to data type, table FOXGUI.dbo.Client_Details', column 'Days_CTS', Use the CONVERT function to run this query
The fields data types are as follows
M_Date smalldatetime
days_CTS Int
I can understand what they mean but I just don;t know the code that I should be using.
ANyone have any ideas?

Updating Date Field With Null Value (date Picker)
Hello,

I am using VB and access. For date I am nsing date Picker. How can I update a date with null value?

I am using the code update the date field:

DateColumn=#" & Format(DTP1, "mm/dd/yyyy") & "#

When I try to udate the field with null value I receive error: syntex error in date in query expression '##'.
Please advice me how to update with null values.

Regards,
Elahi

Comparing 2 Files Date/time Stamps?
Hi all,

Anyone know if it is possible to compare the date/time stamps of two files (these are text files) please?

Any help appreciated. A web search hasn't really turned much up....

Cheers,

Paul.

Comparing Date Of Modification For Files...(RESOLVED)
Hi all.

I need to compare the date of modification on different files and I was wondering if there was an easy way to verify if a file is more recent then another one.

I'm already using the File object which can return a string with the date and time of the last modifications. But these values are Strings. So it is considerably more complicated then just using the "greater than" operand...

Any suggestions???

Thanks!

Comparing Date Values Against A Label Or Textbox
How can I do this? This is what I have tried with no luck. Any advice would be much appreciated.

If CDate(ctDropDate.Value) < Format(lblDate.Caption, "Date", "MMMM dd, YYYY") Then etc etc

Problem Comparing Date/Time Values
I have a function that has to compare datetimes values in order to do some calculations, it is defines as this.

DateTime1 = "07/23/2001 23:35:00"
DateTime2 = "07/23/2001 11:35:00 PM"

they should be the same in value, the only diference is de time format (24h and AM/PM).

As you can see, VB is comparing the datetime values in string format, I dont know if this is the root of the problem, if so, does VB have a function to compare this kind of values, I found the functions DateValue and TimeValue wich compares in the proper data type, is there a function like DateTimeValue?.

Any help or idea on how to get around this problem, would be really appreciated.

Thanks.

Probelm In Comparing 2 Date In Adodc.recordsource Query Run
I have Access database file OrderDetail which has DateDeliver as Date type field .
I want all order record for the next 7 days from today .
 But when i use the code below , the recordset.recordcount returns zero though the table contains some records within that date period.

    Adodc1.RecordSource = "select * from OrderDetail where DateDeliver >= '" & Date & "' and DateDeliver <= '" & DateAdd("d", 6, Date) & "' "
    Adodc1.Refresh


Pls help me to solve the problem .




Edited by - dilip347 on 1/24/2004 2:37:00 AM

Only Want Date Part Of Date Time Field
How can I using an SQL statement just reitrieve the date part of a database field.

The data is stored as 10 05 2001 12:31.

At moment sql is bringing back the whole field. For grouping purposes I only want the date ie 10 05 2003.

Any ideas??

Getting Numbers In Date Field Into Date Format???
in my access db i have an old table and the dates were never formatted eg its just 791023 as in 23 of oct 1979 so i had to change that to get it in date format so i did this using a query

UPDATE history_date SET history_date.theDate = format([theDate]," mm/dd/yy");

like it worked and put in the slashes but the date is different
it came out 01/25/55 when the date was originally 641027
why is it changing it ???
like i tried diff format like yy/mm/dd and still the same...
confused!!please help if u know anything...

Comparing Value Of Text With The Database Vlaue---small Problem Of Date
hi all
  I have a problem with the date/time datatype. i'm using this code

dim temp as date
temp = Trim(txtto.Text)
sql1 = "select * from emp where DUEDATE >='"& temp &"'"

With DataEnvironment1.Commands("Command1")
    .CommandType = adCmdText
    .CommandText = sql1
End With

DataReport1.Show vbModal

but it is giving error as ***** data mismatch in criteria expresion ****
can any one help to get through it.
i tried inmany ways but didnt get it,plz help me out.

thanks
imtiaz

AutoNumber Field Vs. Date Field...?
I have a database with some data. This database has a date field. When I add an AutoNumber field my data become this:


Code:
DateField AutoNumberField
01/01/2004 1
01/01/2003 2
01/01/2002 3

But I'd like to do it, sorting by date:


Code:
DateField AutoNumberField
01/01/2004 3
01/01/2003 2
01/01/2002 1

How to do it?

Thanks.

Again The DATE Field !!
Good Morning Guys, again i want to disturb u all (sorry for that)

My problem is :

I have 30 date fields, if user enters date in any one or few fields, that value(s) only to be stored in tabel. All other fields to be left blank. Is it possible to do like that?

My code is......

VB Code:
Private Sub MonthView1_DateClick(ByVal DateClicked As Date)Me.Controls(strCtrl).Text = MonthView1.ValueMonthView1.Visible = FalseEnd Sub Private Sub Text1_Click()strCtrl = "Text1"MonthView1.ToolTipText = Me.Controls(strCtrl).TopMonthView1.Left = Me.Controls(strCtrl).LeftMonthView1.Visible = TrueEnd Sub Private Sub Text3_Click()strCtrl = "Text3"MonthView1.ToolTipText = Me.Controls(strCtrl).TopMonthView1.Left = Me.Controls(strCtrl).LeftMonthView1.Visible = TrueEnd SubPrivate Sub Text4_Click()strCtrl = "Text4"MonthView1.ToolTipText = Me.Controls(strCtrl).TopMonthView1.Left = Me.Controls(strCtrl).LeftMonthView1.Visible = TrueEnd Sub


The save command is :


VB Code:
Private Sub saveCmnd2_Click()Data1.Recordset.Fields("orders") = DBCombo1.TextData1.Recordset.Fields("ord_dt") = CDate(Text1.Text)Data1.Recordset.Fields("art_dt") = CDate(Text3.Text)Data1.Recordset.Fields("y_po") = CDate(Text4.Text)Data1.Recordset.UpdateEnd Sub


Please guide.

Date Field
Hi I was wondering is there a way to truncate a field which has the date and time.

example
7/8/2004 02:35:01pm

to
7/8/2004

I have a field where the user selects the date but its storing date and time. I would like to only save the date???


Rob

Date() Field
I have set a database up and require it to be run on another machine. All is fine except that the date field which I want to show the sys date come up with the error #Name?. This only happens on the second machine, all is fine when I run the Db on my machine. What could be causing this, font?

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