Reputation: 5377
I have a listbox in Microsoft Access 2010
I am trying to pass all parameters to a new form(frmpopUpPatientInfo) on double click of a record, example when I click on Patient:21, it should pass 21, Clinton, bill to new form.
What i tried is below where lstEvents
is listbox name, frmCalendar
is the parent form
Private Sub lstEvents_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmpopUpPatientInfo"
MsgBox Me.Parent.frmCalendar.lstEvents.Column(1), vbInformation, "Test"
End Sub
The Error i am getting is
Upvotes: 0
Views: 673
Reputation: 786
Try
Forms!frmCalendar!lstEvents.Column(1)
https://www.599cd.com/tips/access/forms-formname-field-notation/
Upvotes: 1
Reputation: 4312
If you are trying to pass to a NEW form that was opened, you should not be using the 'Parent....' reference.
Below are two methods of passing data to a form.
' Pass arguments when the form is opened
DoCmd.OpenForm "frmpopUpPatientInfo", acNormal, , , , , Format(Now(), "DD-MMM-YYYY")
' Or reference a control as follows:
Forms!frmpopUpPatientInfo.myTargetField= Format(Now(), "DD-MMM-YYYY")
Upvotes: 1