Rabu, 21 September 2011

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

"BeforeUpdate event of the ContactID combobox"
This suggests the ContactID combobox hasn't been updated yet. You are driving off without shutting the doors ;-)

Once the other form is opened, the combo box will have been updated.

Duane Hookom
MS Access MVP

To: MS_Access_Professionals@yahoogroups.com
From: no_reply@yahoogroups.com
Date: Wed, 21 Sep 2011 17:56:41 +0000
Subject: [MS_AccessPros] Re: Opening Form to specific record on event from subform (continuous form)


Solved BUT have question.

I used the following code instead:
DoCmd.OpenForm "Contacts"
Forms!Contacts.Recordset.FindFirst "ContactID = " & Forms![Sales]![sub_SoldBuyersSales].Form![ContactID]

Why would the above work and the following wouldn't?
DoCmd.OpenForm "Contacts", , , "ContactID = " & Forms![Sales]![sub_SoldBuyersSales].Form![ContactID]

Thanks!
Connie

--- In MS_Access_Professionals@yahoogroups.com, mrsgoudge <no_reply@...> wrote:
>
> 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
>


[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)

<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

Tidak ada komentar:

Posting Komentar