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

Use combo box and text box for Link criterea in search form

Status
Not open for further replies.

Nelz

Programmer
Sep 27, 2001
50
0
0
US
I'd like to use a combo box on a search form to list about 5 fields from a different form (Orders)...so we can match any of the fields from the combo box to the value typed into the text field...thus opening the Orders form to the correct records based on the link criterea.

That way the user can pick either the OrderDate field, or the ShipDate Field...or the PackDate field...from the drop down list....then type a date into the text box...
It would then open to the records based on that criterea when you click a button. I tried using the following code:

Private Sub Command67_Click()
On Error GoTo Err_Command67_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Orders"

stLinkCriteria = "Me![Combo61]=" & "#" & Me![Text59] & "#"
DoCmd.Openform stDocName, , , stLinkCriteria

Exit_Command67_Click:
Exit Sub

Err_Command67_Click:
MsgBox Err.Description
Resume Exit_Command67_Click

End Sub


but it doesn't work.

Any ideas? Thanks in advance.
 
stLinkCriteria = Me![Combo61]& "=#" & Me![Text59] & "#"
 
That seems to have done it...thanks! Am I correct in assuming this will only work for date fields...I can't throw a name field in on the drop - daown list because of the #'s Right?
Thanks a lot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top