Link to home
Start Free TrialLog in
Avatar of Reyesrj
ReyesrjFlag for Guam

asked on

VBA search in MS Access 2007 Form

Hi All,

I’m working on MS Access 2007.  I have a form (Main Form) with information that is filled out by the user.  What I am trying to do is make another form that opens when the user launches access (This I can do).

In the form that opens at startup, I would like it to have a search / find field or button.  This will search for the record ID.  So when the user types in the record ID it will launch the main form and display that record ID.

Thanks in advance.
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

The simplest way to open another form to a specific record is to use the OpenForm method:

DoCmd.OpenForm "YourForm", acNormal, , "YourIDField=" & Me.YourPopupFormValue

This would be run on the Popup form, perhaps on a Button click or something. Note too that if YourIdField is a Text value, you must do this:

DoCmd.OpenForm "YourForm", acNormal, , "YourIDField='" & Me.YourPopupFormValue & "'"

Note these methods will open a Filtered form, which means your user would only see a single record (assuming your ID returns a single record, of course).
Avatar of Reyesrj

ASKER

Thanks LSMConsulting,

I am a little lost as I’m new to VBA.  But I am very eager to learn.

DoCmd.OpenForm "YourForm", acNormal, , "YourIDField=" & Me.YourPopupFormValue
DoCmd.OpenForm "MainTBL",      acNormal, , "CaseID="         & Me.???

What do gets entered in “YourPopupFormValue”
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Reyesrj

ASKER

Sorry, typing toooooo fast!

What gets entered in.....

I think I understand.  I'll try tomorrow.  I'm not at work.

Thanks
Avatar of Reyesrj

ASKER

I tried something else.
Thanks.