I am using the following code to update my form, open a new form with a new record and then populate certain fields of that new record with data from the previous record:
-------------------------------
Dim strFrm as String
strFrm = "frm_Auto_Accidents"
'save pending edits
Me.Refresh
'open the "other" form
DoCmd.OpenForm strFrm
'create the new record in the newly opened form
DoCmd.GoToRecord acDataForm, strFrm, acNewRec
'reference the newly opened form inside the With block
With Forms(strFrm)
'and set the values of any of its controls
.ClientID = Me.ClientID
.CaseID = Me.CaseID
End With
-------------------------------------------
This code works perfectly. Here is my problem. I also need to pull data from one field which is not on the 1st form(Its in a different table) into a unbound textbox. Is there a few lines of code I can add that will pull the data from the table. The link is not a problem because my tables are linked on client id. I know I can use a query but the whole point of this code was to eliminate the need for a combobox.
Can anyone help?
-------------------------------
Dim strFrm as String
strFrm = "frm_Auto_Accidents"
'save pending edits
Me.Refresh
'open the "other" form
DoCmd.OpenForm strFrm
'create the new record in the newly opened form
DoCmd.GoToRecord acDataForm, strFrm, acNewRec
'reference the newly opened form inside the With block
With Forms(strFrm)
'and set the values of any of its controls
.ClientID = Me.ClientID
.CaseID = Me.CaseID
End With
-------------------------------------------
This code works perfectly. Here is my problem. I also need to pull data from one field which is not on the 1st form(Its in a different table) into a unbound textbox. Is there a few lines of code I can add that will pull the data from the table. The link is not a problem because my tables are linked on client id. I know I can use a query but the whole point of this code was to eliminate the need for a combobox.
Can anyone help?