Can someone please provide some coding help.
I currently have a form, that in the header has an unbound multi-select list box. I also have a command button that is used to take the names selected in the multi-select list box and when clicked, automatically populate the fields on the form so that the end-user can then continue to enter new information.
I am having trouble with the code behind the command button
I am currently getting run time error message 2465 - Can't find 'Forms' referred to in your expression.
The code behind the command button is:
Dim Criteria As String
Dim I As Variant
Criteria = ""
For Each I In Me![List2].ItemsSelected
Criteria = Criteria & " OR [MailingListNameID]=" & Me![List2].ItemData(I)
Next I
If Criteria <> "" Then
Criteria = Mid(Criteria, 5)
End If
Me.Filter = Criteria
Me.FilterOn = True
Other potentially key information
I am trying to take the mailinglistnameID selected in the list box and have it automatically populate a field on the form called mailinglistname.mailinglistnameID.
The form is based on the following query.
SELECT MailListName.MailingListNameID, MailListName.MailingListName1, MailListName.Selected, EventMailList.MailingListNameID, EventMailList.[Event ID], EventMailList.Invited, EventMailList.EventMailListID
FROM MailListName LEFT JOIN EventMailList ON MailListName.MailingListNameID = EventMailList.MailingListNameID
WHERE (((EventMailList.[Event ID])=[Forms]![Event Planning]![Event ID]));
The list box is based on the following query
SELECT MailListName.MailingListNameID, MailListName.MailingListName1
FROM MailListName
ORDER BY MailListName.MailingListName1;
I would really appreciate some help or direction on how to make this code work.
Thanks in advance for any suggestions
I currently have a form, that in the header has an unbound multi-select list box. I also have a command button that is used to take the names selected in the multi-select list box and when clicked, automatically populate the fields on the form so that the end-user can then continue to enter new information.
I am having trouble with the code behind the command button
I am currently getting run time error message 2465 - Can't find 'Forms' referred to in your expression.
The code behind the command button is:
Dim Criteria As String
Dim I As Variant
Criteria = ""
For Each I In Me![List2].ItemsSelected
Criteria = Criteria & " OR [MailingListNameID]=" & Me![List2].ItemData(I)
Next I
If Criteria <> "" Then
Criteria = Mid(Criteria, 5)
End If
Me.Filter = Criteria
Me.FilterOn = True
Other potentially key information
I am trying to take the mailinglistnameID selected in the list box and have it automatically populate a field on the form called mailinglistname.mailinglistnameID.
The form is based on the following query.
SELECT MailListName.MailingListNameID, MailListName.MailingListName1, MailListName.Selected, EventMailList.MailingListNameID, EventMailList.[Event ID], EventMailList.Invited, EventMailList.EventMailListID
FROM MailListName LEFT JOIN EventMailList ON MailListName.MailingListNameID = EventMailList.MailingListNameID
WHERE (((EventMailList.[Event ID])=[Forms]![Event Planning]![Event ID]));
The list box is based on the following query
SELECT MailListName.MailingListNameID, MailListName.MailingListName1
FROM MailListName
ORDER BY MailListName.MailingListName1;
I would really appreciate some help or direction on how to make this code work.
Thanks in advance for any suggestions