Form Find Date (1 Viewer)

sundaram

Registered User.
Local time
Today, 07:32
Joined
May 28, 2009
Messages
36
Dear, I have tried several ways but it is not pulling the record. "Not Fund" Msg is displaying.

I have tried entering date as dd/mm/yyy, mm/dd/yy and dd/mm/yyyy.

I table "SubittalDate" is date type and Medium date in display so Please heop 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 tblemp.MBD"
Exit Sub
End If
Strsql = "SUBMITTALDATE=#" & Format(DtCri, "mm/dd/yy") & "#"

rst.FindFirst Strsql
Debug.Print Strsql
If rst.NoMatch = False Then
Movefields
Else
MsgBox "Not Found."
rst.MoveFirst
End If
 

namliam

The Mailman - AWF VIP
Local time
Today, 05:32
Joined
Aug 11, 2003
Messages
11,695
Inputbox:
Displays a prompt in a dialog box, waits for the user to input text or click a button, and returns a String containing the contents of the text box.

This is your problem, you can format anything in anyway on a string, but that doesnt change what you are sending in.
 

sundaram

Registered User.
Local time
Today, 07:32
Joined
May 28, 2009
Messages
36
Please let me know clear, I am a fresher to this programming. Kindly go through the code, to put the data.
 

sundaram

Registered User.
Local time
Today, 07:32
Joined
May 28, 2009
Messages
36
Please let me know clear, I am a fresher to this programming. Kindly go through the code, to put the data.

Since the code was not working properly hence i putup a question.


I think some where there is a mistake in the code.
 

namliam

The Mailman - AWF VIP
Local time
Today, 05:32
Joined
Aug 11, 2003
Messages
11,695
As per the access help:
Inputbox:
Displays a prompt in a dialog box, waits for the user to input text or click a button, and returns a String containing the contents of the text box.


This is your problem, you can format anything in anyway on a string, but that doesnt change what you are sending in.

You cannot do Format on a string! Period! You have to convert the string into a date first, using a function like DateSerial first.

An alternative may be to use a "search form" instead of an input box. Search the forum for some samples.
 

sundaram

Registered User.
Local time
Today, 07:32
Joined
May 28, 2009
Messages
36
As per the access help:



This is your problem, you can format anything in anyway on a string, but that doesnt change what you are sending in.

You cannot do Format on a string! Period! You have to convert the string into a date first, using a function like DateSerial first.

An alternative may be to use a "search form" instead of an input box. Search the forum for some samples.


Thanks & I have tried it by converting, I got the result.
I have form which is having details of employee whose date of join name etc. on that form it self i have a find command assigned.

"Search form" will put data from the table or will it search forms.

Please let me know further details.

Thanks once again.
 

namliam

The Mailman - AWF VIP
Local time
Today, 05:32
Joined
Aug 11, 2003
Messages
11,695
A search form functions like an Input box, except you draw the information from the form.
Advantage is you can set data types of controles, an inputbox will always return a string causing you these problems.
 

DCrake

Remembered
Local time
Today, 04:32
Joined
Jun 8, 2005
Messages
8,632
Again you are double posting!!! This can lead to conflicting responses from other users/members. This only leads to contempt and people will stop responding as they don't know if you have resolved a problem or not.

David
 

Users who are viewing this thread

Top Bottom