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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime 2501 Error when opening form with date condition

Status
Not open for further replies.

Joshua61679

Technical User
Dec 28, 2001
36
US
Hello all,
Just spent another day fighting a runtime error, and I give up. This is the code I am using:

Private Sub OpenHole_Click()

Dim strCutomer As String
Dim strLease As String
Dim strDate As String
Dim strWhere As String

strCustomer = Me!Customer
strLease = Me!OpenHole.Column(0)
strDate = Me!OpenHole.Column(2)

strWhere = " Customer = '" & strCustomer & "' AND " _
& " Lease = '" & strLease & "' AND Date = '" & strDate & "'"

Call DoCmd.OpenForm("Open", , , strWhere, acFormEdit)
End Sub

Well, kind of, I've only got 2 lines for the strWhere, so I'm not really mising a line connector there.

At anyrate, I'm getting a 2501 runtime error, I believe relating to the date portion of the strWhere line. Any ideas why? (Both the Me!OpenHole.Column (2) and the Form!Open!Date field are date formatted if that makes a difference.) Thanks in advance for any help.

Joshua
 
Hiya,

Try this....

Call DoCmd.OpenForm "Open", , , strWhere

That is if your form IS really called 'Open'.
If not, replace 'Open' with your form name.

Regards,

Darrylle



"Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top