Rabu, 21 September 2011

[MS_AccessPros] Opening Form to specific record on event from subform (continuous form)

 

Form "Sales" has a subform "sub_SoldBuyersSales" which is continuous. Contacts(Buyers) are entered in this subform. In the event that a contact matches a certain criteria I would like the Contact form to open to that contacts record. I have the code in the BeforeUpdate event of the ContactID combobox of the subform.

Currently the Contact form is opening but to a new record. I've tried several things and can't get it to open to the correct record. In the following code ContactID2 is the name of the textbox on the Contact form. Here's the code I'm currently using:

Private Sub ContactID_BeforeUpdate(Cancel As Integer)
On Error GoTo Proc_Err
If Not IsNull(DLookup("ContactID", "LookingEvent", "ContactID = " & Me.ContactID)) Then
Msgbox "This buyer has looked previously with AER" _
& vbNewLine & "Enter as a Past Buyer if needed"
DoCmd.OpenForm "Contacts", , , "ContactID2 = " & Me.ContactID
End If

Thanks!
Connie

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar