Linking from one form to a new record in another form

lskuff

Registered User.
Local time
Today, 07:02
Joined
Aug 10, 2003
Messages
14
I need to know how I can link from a form to create a new record in another form (so that no data shows up on the form). For example there is a Seminar form and a form that has a page of information on each seminar attendee (name, address, etc) and I need to make a button to add a new attendee (enter their name etc).


Sorry that is kind of confusing but I tried to explain it as best as I could.
 
You can have a button on the Seminar form that when click opens up the seminar attendee form ready to accept new records, use code like this:

DoCmd.OpenForm "frmSeminarAttendee", acNormal, , , acFormAdd

The important part of that code is the 5th parameter which is the DataMode that the opened form will be in. In this case acFormAdd tell Access that you want to open the form to accept new records and not to display existing records.
 
Can anyone please help me?

I have an additional question about adding/linking a new record to an existing form. I have 2 data entry forms, Address (ID and Last/First Name, other stuff) and Certifications(ID, other stuff). Both are related by a Unique "ID". When a new record is added on the Address form, I created a command button (DoCmd.OpenForm) on the Address form that will add a new Certification record which pops open as a blank form....this is works well.

How can I link the two forms together in such a way that when you click to add a new Certification record that 'ID' and 'Name' are automatically inserted? I want to prevent unwanted ID/Name entries.

Thanks for your help,

Debo:confused:
 
Debo,

You can either use the OpenArgs argument of the OpenForm Command or use Forms("YourCertificateForm").ThatID to reference that ID and put it into your Foreign Key field in the On Open Event.

Hope that gets you going, if not... Ask Away.

Regards

The Mailman
 
Mailman:

I understand what you saying, but I'm sure of the proper code. I think OpenArgs is suitable. Here's what I have...what should I change?

Private Sub cmdNewCertRec_Click()
On Error GoTo Err_cmdNewCertRec_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.OpenForm "frmMasterCertification", acNormal, , , acFormAdd
DoCmd.OpenAr
Exit_cmdNewCertRec_Click:
Exit Sub

Err_cmdNewCertRec_Click:
MsgBox Err.Description
Resume Exit_cmdNewCertRec_Click

End Sub

Thanks,

Debo
 
Thanks! That worked great. Just one more quick thing. How can I make the new black form be focused. How it is now it is behind the Seminar form and even when I click it I can't get it to show up on top of the seminar form.
 

Users who are viewing this thread

Back
Top Bottom