Moving Details from one form to another

faz88

Registered User.
Local time
Today, 15:41
Joined
Mar 31, 2008
Messages
34
I have a form which shows available times for a booking. When i double click on a time , the main booking form opens but the details selected does not transfer to the booking form. Is there a particular way of doing this?
at the moment i am using the [forms]![form-name]![fieldname] method.
 
You could pass the details to the new form via the OpenArgs in the DoCmd, and then pick them up in the OnLoad event of the form being opened.
 
You can use the WHERE clause parameter on the Docmd.OpenForm method to select the correct record in your details form. This assumes the details form is data bound and that there is field on the parent form that contains the primary key - usually an invisible textbox.

Also, it's not a bad idea to add a little error checking to make sure txtPrimaryKey contains a value before opening the details form.

Code:
    If Not IsNull(Me.txtPrimaryKey) Then
        DoCmd.OpenForm "frmDetails", , , "PrimaryKey=" & Me.txtPrimaryKey
    End If
 

Users who are viewing this thread

Back
Top Bottom