Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open form stLinkcriteria for short date not working

Status
Not open for further replies.

nmapeso

Technical User
Aug 26, 2005
28
0
0
US
hello the when open form with date is null works okay but when enter date (Short Date) dd/mm/yyyy give me a form with blank fields, but If I enter the (reverse) MM/DD/YYYY works okay. Not sure how to fixed. IUser have to enter a format of date DD/MM/YYYY
I try format, validation rule, nothing works.

Field EnterDate is set to short date with input mask of 00/00/0000;0;_ on the frmQueryrecieved.
Private Sub Open_Click()
On Error GoTo Err_Open_Click

Dim stDocName As String
Dim stLinkCriteria As String

If IsNull(Me![EnterDate]) Then
stLinkCriteria = "[DateESent] Is Null"
Else
stLinkCriteria = "[DateESent]=" & "#" & Me![EnterDate] & "#"
End If
stDocName = "maintblBankruptcy"
[Forms]![maintblBankruptcy]!cmdfilter.Visible = True
Me.Visible = False
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close , "frmQueryrecieved"

Exit_Open_Click:
Exit Sub

Err_Open_Click:
MsgBox Err.Description
Resume Exit_Open_Click

End Sub
 
Date is date ... and Jet isn't happy with that format, you need unambiguous format, see International Dates in Access, though I use

[tt]stLinkCriteria = "[DateESent]=" & "#" & format$(Me![EnterDate], "yyyy-mm-dd") & "#"[/tt]

Roy-Vidar
 
You may try this:
stLinkCriteria = "[DateESent]=#" & Format(Me![EnterDate], "yyyy-mm-dd") & "#"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks to everybody, YOu guys are smart. Works fine now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top