Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Missing something very basic?

$
0
0
I have a command button on a (Contacts) form, to open a second form and apply the ContactID of the current record to that form. It seems okay if there are no existing records already assigned to that particular ContactID, as it opens to a new record in the second form, with the ContactID already populated. However, when a contact already has an associated record in the second form, it opens to that record, instead of a new record. What am I missing? I hasten to add I am completely new to databases and coding etc., so I'm learning as I go.

My code is as follows:

'Open the enquiry form and enter data for this person.

If Not IsNull(Me.ContactID) Then
DoCmd.OpenForm "frmEnquiry", , , , , , Me.ContactID
End If
DoCmd.OpenForm "frmEnquiry", , , "ContactID=" & Me.ContactID

Is there a way to get the second form to always open to a new record for the current contact, even if a contact already has other 'contact events' existing in the Enquiry table?

Also, if a user tries to open the second form without first entering contact details, is there a way to cancel the action and advise that they must be on an existing record for this button to operate?

Hope this makes sense!

Many thanks.

Viewing all articles
Browse latest Browse all 13329

Trending Articles