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

Browse Facility

Status
Not open for further replies.

rookery

Programmer
Apr 4, 2002
384
GB
Is this harder than it looks? I have a "Browse" Form with a Subform on it. The Form and the Subform are linked (recordsource) to the Clients table. The subform displays the table in Datasheet mode. The idea is, when a user selects a field, the "Browse" Form closes and the main "Clients" Form opens, displaying the record just selected in the Browse Form. I have have used the following code behind a button on the Browse Form:

DoCmd.Echo False
strCriteria = "[custid]= " & (Forms!Browse!CustID) & ""
DoCmd.OpenForm "Clients"

Set MyRs = Forms!Clients.RecordsetClone

MyRs.FindFirst strCriteria

If Not MyRs.NoMatch Then
Forms!Clients.Bookmark = MyRs.Bookmark
End If

DoCmd.Maximize
DoCmd.Close acForm, "Browse"
DoCmd.Echo True

If I substitute a number in for the "(Forms!Browse!CustID)" code the correct record is displayed in the Clients Form. Yet that code in itself always seems to pick the first record in the table and not the one the user selects. It seems to have a problem identifying what is selected. If anyone can make sense of this please let me know.
 
OK so it was simply a case of putting:

Forms!Browse!"subFormName"!CustID

in place of the above. No-one ever tells you these things...!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top