I have a table named "Event". I have records in the table that I want to populate the rest of the forms unbound text fields based upon the selection of the combo box "event name" and combo box "event date".
The table fields are:"Event Name", "Event Date","Call for Service", "POC Name", "POC Phone 1", "POC Phone 2", "Event Instructions"
The unbound form field names are:"QEvent Name", "QEvent Date", "QCall for Service", "QPOC Name", "QPOC Phone 1", "QPOC Phone 2", "QEvent Instructions"
POC means Point of Contact.
I know that I want to have this form filled in after the "event date" event procedure afterupdate but I cannot get my query to do anything but generate a new table with the correct results.
I feel I am close and want to assign the results from the query to the unbound form field names but I don't know how to do it.
Thank you in advance for any direction you can provide.
Error message is : User defined type not defined. Refering to the line :"Dim rs As ADODB.Recordset"
Code:
Private Sub QEvent_Date_Combo_AfterUpdate()
DoCmd.OpenQuery "Display Call for Service", acViewNormal
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "SELECT * " & "FROM [Event] " & "WHERE (((" & Me.[Event Name] & ") = " & [Forms]![Event]![QEvent Name Combo] & ") And " & "((" & Me.[Event Date] & ") = " & [Forms]![Event]![QEvent Date Combo] & "))", CurrentProject.Connection
IfNot rs.EOF
Me.QCall_for_Service.Value = rs![Call for Service]
Me.QEvent_Type.Value = rs![Event Type]
Me.QPOC_Name.Value = rs![POC Name]
Me.QPOC_Phone_1.Value = rs![POC Phone 1]
Me.QPOC_Phone_2.Value = rs![POC Phone 2]
Me.QEvent_Instructions.Value = rs![Event Instructions]
End If
Set rs = Nothing
End Sub