Dialog form form pops up blank when should autofill from originating subform (1 Viewer)

lilminx

Registered User.
Local time
Today, 14:25
Joined
Feb 3, 2009
Messages
10
Hi there,

I have a parent form (frm_TelesalesContact) with a datasheet subform (frm_subform_TelesalesContact). The dialog form (frm_dialog_IndividualContact) pops up on the specific record double clicked on within the subform.

However when you double click on a new record in the subform the dialog pops up entirely blank (not even empty fields are showing). In this instance I would lik the dialog form to create th new record and autofill the contents with the info from the subform. Can and how can this be done?

The fields that I want to autofill are:
CustCode
DelSeqCode
ContactDate
ContactTime

The current coding I have o the double click event procedure for the CustCode field in the subform is:
**
Private Sub CustCode_DblClick(Cancel As Integer)

DoCmd.OpenForm "frm_dialog_IndividualContact", acNormal, , "[CustCode]='" & Me.[CustCode] & "' And [DelSeqCode]='" & Me.[DelSeqCode] & "' And [ContactDate]=#" & Me.[ContactDate] & "# And [ContactTime]=#" & Me.[ContactTime] & "#", , acDialog

End Sub
**

I just had a thought that one way round it could perhaps be a new record button. Though how/where I would/could display this I don't know. Can you diplay buttons on a datasheet subform or would it need to be displayedon the main form? How would you code a button like that?

Please let me know if anymore information is required.

Thank you in advance for your assistance.

Jodie
 
Last edited:

RuralGuy

AWF VIP
Local time
Today, 07:25
Joined
Jul 2, 2005
Messages
13,826
How about something like:
Code:
Private Sub CustCode_DblClick(Cancel As Integer)

   If Not Me.NewRecord Then
      DoCmd.OpenForm "frm_dialog_IndividualContact", _
                     , _
                     , _
                     "[CustCode]='" & Me.[CustCode] & _
                     "' And [DelSeqCode]='" & Me.[DelSeqCode] & _
                     "' And [ContactDate]=#" & Me.[ContactDate] & _
                     "# And [ContactTime]=#" & Me.[ContactTime] & "#", _
                     , _
                     acDialog
   Else
      DoCmd.OpenForm "frm_dialog_IndividualContact", _
                     , _
                     , _
                     , _
                     acFormAdd, _
                     acDialog
   End If
End Sub
 

lilminx

Registered User.
Local time
Today, 14:25
Joined
Feb 3, 2009
Messages
10
Thank you very much, that works perfectly:)
 

RuralGuy

AWF VIP
Local time
Today, 07:25
Joined
Jul 2, 2005
Messages
13,826
Glad I could help. Thanks for posting back with your success.
 

Users who are viewing this thread

Top Bottom