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.
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.