I am developing a database for a white water rafting company.
I've created a reservation form for incoming phone calls.
This main form uses a link table to show previous reservations (who was the paying client), and subform to use this link table, showing the client's info.
For a new incoming phone call, the user clicks a button, which opens an address form.
The user can search for a previous client (a repeat customer).
My question to this forum:
I've tried and tried to populate the main form's subform with the "previous client" info, but no luck. Can you help?
(See attached)
I have tried six different methods in VBA, but no luck. Any help?
Seems simple to just use the "Client ID" from the found search.
Code:
' Method 1
'Set db = CurrentDb
'Set rst = Me.RecordsetClone
'strCriteria = "[Client ID] = " & Me.Client_ID
'rst.FindFirst strCriteria
' ==============================
' Method 2
'Set db = CurrentDb
'Set rst = Me.RecordsetClone
'Me.Bookmark = rst.Bookmark
'Forms![frm Call Sheet 3]![frm Address Book short].Bookmark = rst.Bookmark
' ==============================
' Method 3
'needed_client = Me.Client_ID
' Trip_De = Forms![frm Call Sheet 3].[Trip Detail ID]
'Forms![frm Call Sheet 3]![frm Address Book short].Form![Client ID].SetFocus
'Forms![frm Call Sheet 3]![frm Address Book short].Form![Client ID].Recordset.FindFirst "Client ID=" & needed_client
' or
'Forms![frm Call Sheet 3]![frm Address Book short].Recordset.FindFirst "Client ID=" & needed_client
' ===================================
' Method 4
' strSQL = "[Client ID] = " & Me.Client_ID
' DoCmd.ApplyFilter wherecondition:=strSQL
'strSQL = "[Client ID] = " & Me.Client_ID
'Forms![frm Call Sheet 3].SetFocus
'Forms![frm Call Sheet 3]![frm Address Book short].SetFocus
'Forms![frm Call Sheet 3]![frm Address Book short].Form![Client ID].SetFocus
'DoCmd.ApplyFilter wherecondition:=strSQL
' ===================================
'Method 5
'Help with sytax - DoCmd.FindRecord StaffNo, , , , , acCurrent
'DoCmd.FindRecord needed_client, , , , , acCurrent
' Me.Filter = "[Envelope Full Name] like ""*" & Me.txtFilter1 & "*"""
' Me.FilterOn = True
'DoCmd.OpenForm "frm Call Sheet 3", acNormal, "", "", , acNormal
'Call frm_Address_Book_short.Command152_Click
' =======================================
' Method 6
'strSQL = "SELECT [tbl Client contact list].[Client ID], [tbl Client contact list].[Last Name], [tbl Client contact list].[First Name], [tbl Client contact list].Address, [tbl Client contact list].City, [tbl Client contact list].State, [tbl Client contact list].ZIP, [tbl Client contact list].[Cell Phone], [tbl Client contact list].[Home phone], [tbl Client contact list].[E-mail], [tbl Client contact list].[Emergency contact name], [tbl Client contact list].[Emergency contact relation], [tbl Client contact list].[Emergency contact phone], [tbl Client contact list].[Medical conditions], [tbl Client contact list].Sex, [tbl Client contact list].Age, [tbl Client contact list].[Meal preference], [tbl Client contact list].Vegetarian, [tbl Client contact list].[Organization name]"
'strSQL = strSQL & " FROM [tbl Client contact list]"
'strSQL = strSQL & " WHERE [tbl Client contact list].[Client ID]=" & needed_client & ";"
'Forms![frm Call Sheet 3]![frm Address Book short].Form.RecordSource = strSQL
' ==============================
' Update table for "frm Call Sheet 3
'Set db = CurrentDb
'Set rst = db.OpenRecordset("tbl lnk Trip n Clients")
'rst.AddNew
'rst![Trip Detail ID] = Trip_De
'rst.Update
'Help with sytax - DoCmd.RunSQL "UPDATE tableName SET fieldName=444 WHERE pk=FORMS!formName!ControlName "
'DoCmd.RunSQL "UPDATE [tbl lnk Trip n Clients] SET [Client ID]=" & needed_client & " WHERE [Trip Detail ID]=" & Trip_De
Forms![frm Call Sheet 3]![frm Address Book short].Form.Requery
DoCmd.OpenForm "frm Call Sheet 3", acNormal, "", "", , acNormal