G
Guest
Hello everyone! Using A02 on XP. Not a programmer but learning bit by bit.
I'm using the code below to allow users to fill in a few fields with the
agent data if it applies, otherwise they key in the data. However, I need the
agent info that applies to the contract record that is showing on my form.
The text field is: Forms![fAcceptanceLetter]![PlanNum].
How would I insert a WHERE clause below? Can I? Am I on the right track here?
Private Sub AgtInfo_Click()
'Open a recordset on qInsertAgentInfo
Dim rstR As DAO.Recordset
Set rstR = CurrentDb.OpenRecordset("qInsertAgentInfo")
'Update the values in the subform
Forms![fAcceptanceLetter]![SOURCECOMPANY] = _
rstR.Fields("AgencyName").Value
Forms![fAcceptanceLetter]![SOURCECONTACT] = _
rstR.Fields("Agent Name").Value
Forms![fAcceptanceLetter]! = _
rstR.Fields("AgtEmail").Value
Forms![fAcceptanceLetter]![PHONENUM] = _
rstR.Fields("AgtPhone#").Value
Forms![fAcceptanceLetter]![FAXNUM] = _
rstR.Fields("AgtFax#").Value
rstR.close
End Sub
Thanks in advance for any help or advice!!!
I'm using the code below to allow users to fill in a few fields with the
agent data if it applies, otherwise they key in the data. However, I need the
agent info that applies to the contract record that is showing on my form.
The text field is: Forms![fAcceptanceLetter]![PlanNum].
How would I insert a WHERE clause below? Can I? Am I on the right track here?
Private Sub AgtInfo_Click()
'Open a recordset on qInsertAgentInfo
Dim rstR As DAO.Recordset
Set rstR = CurrentDb.OpenRecordset("qInsertAgentInfo")
'Update the values in the subform
Forms![fAcceptanceLetter]![SOURCECOMPANY] = _
rstR.Fields("AgencyName").Value
Forms![fAcceptanceLetter]![SOURCECONTACT] = _
rstR.Fields("Agent Name").Value
Forms![fAcceptanceLetter]! = _
rstR.Fields("AgtEmail").Value
Forms![fAcceptanceLetter]![PHONENUM] = _
rstR.Fields("AgtPhone#").Value
Forms![fAcceptanceLetter]![FAXNUM] = _
rstR.Fields("AgtFax#").Value
rstR.close
End Sub
Thanks in advance for any help or advice!!!