View Full Version : Button in a subform - Diva in distress


lizcraw
08-07-2000, 10:16 AM
I have a form with a button that opens a second form, this works fine until I drag it into a third form. (button on a subform)

Now when I use the button an Enter Parameter Value box appears. "Forms!Contacts!ContactID"

I haven't changed the code in the event proceedure, because it still works when it's not in the subform. This is what I have now:

Private Sub Events____Click()
On Error GoTo Err_Events____Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Calls"

stLinkCriteria = "[ContactID]=" & Me![ContactID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Events____Click:
Exit Sub

Err_Events____Click:
MsgBox Err.Description
Resume Exit_Events____Click

End Sub

I am at a loss, any ideas???
Thanks

Karl K
08-07-2000, 01:17 PM
1. Maybe there is no Contact ID on the new form.
2. Maybe the form contact is not open.
3. Maybe on the form you are opening in the dataset there is the criteria (=forms.contact.contact id) and 2. as well.

Try that, if no go, write again.

lizcraw
08-08-2000, 05:42 AM
Thanks for the help, for 1-2: ContactID is in the new form and the form contact is open.

However in the "Record Source" field in the properties for the "Calls" form I have: SELECT DISTINCTROW Contacts.* FROM Contacts WHERE (([Contacts].[ContactID]=[forms]![Contacts]![ContactID]));

Do I need to edit this now that Contacts is a subform? or am I (still) totally off?