Form - Find Date (1 Viewer)

sundaram

Registered User.
Local time
Tomorrow, 02:52
Joined
May 28, 2009
Messages
36
The following code is showing only "Not Found", what is error in the code. please advise me.


Dim Strsql As String
Dim DtCri As Date
Dim X As String
X = rst.Fields("SUBMITTALDATE").Value
DtCri = InputBox("Enter the SUBMITTALDATE", "Enter the Date/", "Question/")
If Len(DtCri) = 0 Then
MsgBox Prompt:="No Criteria Specified", Title:="Search tblRFI.MBD"
Exit Sub
End If
'Strsql = "SUBMITTALDATE=#" & Format(DtCri, "mm/dd/yy") & "#"
Strsql = "SUBMITTALDATE=#" & DtCri & "#"
rst.FindFirst Strsql
Debug.Print Strsql
If rst.NoMatch = False Then
Movefields
Else
MsgBox "Not Found."
rst.MoveFirst
End If
 

DCrake

Remembered
Local time
Today, 23:52
Joined
Jun 8, 2005
Messages
8,632
Change to

Strsql = "SUBMITTALDATE=#" & CDate(DtCri) & "#"

Also is the format of the date the same as the table?
 

sundaram

Registered User.
Local time
Tomorrow, 02:52
Joined
May 28, 2009
Messages
36
Change to

Strsql = "SUBMITTALDATE=#" & CDate(DtCri) & "#"

Also is the format of the date the same as the table?


Dear,


Thanks for your kind reply,

Still it is showing the same msg "Not Found". I have checked it the date type is Date\time (medium date) in table and in the form it is medium date. It is not showing any error in the code but it is not pulling the data.

Please do the suggest me.
 

DCrake

Remembered
Local time
Today, 23:52
Joined
Jun 8, 2005
Messages
8,632
What is being returned by sqlstr?

Dim X As String
X = rst.Fields("SUBMITTALDATE").Value

Why is this in your code when its not being used?

What is the recordsource for the form?
 

sundaram

Registered User.
Local time
Tomorrow, 02:52
Joined
May 28, 2009
Messages
36
Change to

Strsql = "SUBMITTALDATE=#" & CDate(DtCri) & "#"

Also is the format of the date the same as the table?



Thanks to your reply
Now it is working out, Its very fine.
 

Users who are viewing this thread

Top Bottom