D
Deb Smith
I have a form called CreateMailList that consists of a multiselect list box,
two fields (MailingListNameID and MailingListName) and a command button. The
Command Button is being used to restrict records shown on the form. This
finally works great. (Thanks to the help of others)
I now want to add a second command button that will open up a second
form.Form2 needs to be populated with the selected records from form1
identified on it. I need to then be able to have then end-user add
information to each of these records on form2. In addition, the user should
be able to add a record individually without having to go back to Form1. Can
anyone help me in identifying how to do this?
Do I use a DoCmd.Open Form.. If so what would this code look like?
Do I use Link Criteria..If so what would this code look like
Do I use some other method or can this not be done at all.
I really am at a loss as to how to proceed. HELP PLEASE!!
Below is some information about form 1 and form 2 that might give some
clues.
INFO ABOUT FORM 1
I have a form called CreateMailList. The record source for the form is table
called "MailList"
Table - MailList
Field1 - Mailing ListNameID - (Primary Key- autonumber)
Field2 - MailingListName
The form consists of a multiselect list box, two fields (MailingListNameID
and MailingListName) and a command button.
The Unbound list box has as its record source MailList with
Record Source - MailList
Bound Column1
Column Count2
Column Widths .5,2
The Command Button is being used to restrict records shown on the form. I am
using the following code in the onClick event for the command button
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
INFO ABOUT FORM 2 -Form 2 is based on two tables
Record Source for Form 2- SELECT DISTINCTROW MailList.MailingListName1,
MailList.MailingListNameID, EventMailList.MailingListNameID,
EventMailList.Invited, EventMailList.NumberInvited, EventMailList.[Event ID]
FROM MailList LEFT JOIN EventMailList ON MailList.MailingListNameID =
EventMailList.MailingListNameID;
Table1 - MailList
Field1 - MailingListNameID(PrimaryKey- autonumber)
Field2 - MailingListName - txt field
Table 2 - EventMail
Field1 - EventMailListID (Primary Key - autonumber)
Field 2 - MailingListNameID - (number field - lookup SELECT
MailList.MailingListNameID, MailList.MailingListName1 FROM MailList;
Field 3 - Invited (Yes/No)
Field 4 - NumInvited
EventID - (Number field - lookup SELECT [Event Info].[Event ID], [Event
Info].[Event Date], [Event Info].OccassionID FROM [Event Info];
The fields on form 2 are
Field 1 -Event.MailingListNameID
Field 2- Invited
Field 3- NumInvited
Field 4 - Event ID
Once again, thanks for any help and suggestions.
two fields (MailingListNameID and MailingListName) and a command button. The
Command Button is being used to restrict records shown on the form. This
finally works great. (Thanks to the help of others)
I now want to add a second command button that will open up a second
form.Form2 needs to be populated with the selected records from form1
identified on it. I need to then be able to have then end-user add
information to each of these records on form2. In addition, the user should
be able to add a record individually without having to go back to Form1. Can
anyone help me in identifying how to do this?
Do I use a DoCmd.Open Form.. If so what would this code look like?
Do I use Link Criteria..If so what would this code look like
Do I use some other method or can this not be done at all.
I really am at a loss as to how to proceed. HELP PLEASE!!
Below is some information about form 1 and form 2 that might give some
clues.
INFO ABOUT FORM 1
I have a form called CreateMailList. The record source for the form is table
called "MailList"
Table - MailList
Field1 - Mailing ListNameID - (Primary Key- autonumber)
Field2 - MailingListName
The form consists of a multiselect list box, two fields (MailingListNameID
and MailingListName) and a command button.
The Unbound list box has as its record source MailList with
Record Source - MailList
Bound Column1
Column Count2
Column Widths .5,2
The Command Button is being used to restrict records shown on the form. I am
using the following code in the onClick event for the command button
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
INFO ABOUT FORM 2 -Form 2 is based on two tables
Record Source for Form 2- SELECT DISTINCTROW MailList.MailingListName1,
MailList.MailingListNameID, EventMailList.MailingListNameID,
EventMailList.Invited, EventMailList.NumberInvited, EventMailList.[Event ID]
FROM MailList LEFT JOIN EventMailList ON MailList.MailingListNameID =
EventMailList.MailingListNameID;
Table1 - MailList
Field1 - MailingListNameID(PrimaryKey- autonumber)
Field2 - MailingListName - txt field
Table 2 - EventMail
Field1 - EventMailListID (Primary Key - autonumber)
Field 2 - MailingListNameID - (number field - lookup SELECT
MailList.MailingListNameID, MailList.MailingListName1 FROM MailList;
Field 3 - Invited (Yes/No)
Field 4 - NumInvited
EventID - (Number field - lookup SELECT [Event Info].[Event ID], [Event
Info].[Event Date], [Event Info].OccassionID FROM [Event Info];
The fields on form 2 are
Field 1 -Event.MailingListNameID
Field 2- Invited
Field 3- NumInvited
Field 4 - Event ID
Once again, thanks for any help and suggestions.