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!

Open form and display specific records on button click

Status
Not open for further replies.

Nelz

Programmer
Sep 27, 2001
50
0
0
US
Can you select one field from multiple fields in a drop down list...and match that to a text field where you type in a value? I'd like to do this search from a separate search form on a button click.

I tried this but it doesnt work:
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
 
Hi Netz

Not sure if this is what you mean, but in a project I have been developing I have a listbox showing addresses. By double clicking on an address I can bring up a pop-up form with the active address displayed, the active address being linked to the address ID:

Private Sub List0_DblClick(cancel As Integer)

DoCmd.OpenForm "subfrmAddressEdit", , , "AddressID = " & Me!List0

End Sub

Hope this is of help.

JR
 
Well....that's a little different, but thatnks anyway...
 
Is your criteria a date value or straight text? What you've got should work if it's a date value, but if it's text, use apostrophes instead of pound signs to surround the value.
 
Not sure I totally understand your question, but by "select one field from multiple fields" do you mean that your combo box displays several columns and that you want to pick up the value from a specific column as the criteria for your search?

If that's the issue, look at the properties for the combo control . .there is a property which lets you specify the bound column, which will be column whose value is returned. - - - -

Bryan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top