Pass "EventID" to other form and open Record ??

morfusaf

Registered User.
Local time
Today, 13:35
Joined
Apr 24, 2012
Messages
78
Hi all,

I have a simple, formUpdateWhichEvent form... this form basically just has a date Textbox, I select the date the event was on, then It has a combo box populated by which events were on that date, (this also populates the current form with the Eventtype from that event) then I press a button to open the formUpdateEvent.



I am using a Case, so I open the correct form depending on which type of event..

I thought I had this working properly until I realized it wasn't bringing up the correct Event on the new form, it was just bringing up the first record.

So, This is the code I am wanting to use... I just don't know where to put it... or how to pass the EventID to the new form. ..

Code:
    ' ------
    DoCmd.SearchForRecord , "", acFirst, "[EventID] = " & Str(Nz(Screen.ActiveControl, 0))
 
It sounds to me like you should be opening the formUpdateEvent form with that where clause rather than searching for it after it's opened:

Code:
If Nz(cboEvent, 0) > 0 Then DoCmd.OpenForm "formUpdateEvent", , , "[EventID] = " & cboEvent

I've replaced Screen.ActiveControl with what I guess the name of the combobox is. The ActiveControl is probably not always going to be the combobox. Change cboEvent to the name of the combobox.
 

Users who are viewing this thread

Back
Top Bottom