By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,824 Members | 2,337 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,824 IT Pros & Developers. It's quick & easy.

opening a form from a combo box

P: n/a
Hi folks.

I have a combo box with a list of names. I want to be able to click
(or press "enter" on) a name, which will open a separate form which
shows a group of records that corresponds to that name (e.g. "Borrow
History" table/query with its corresonding form, which holds the
details of books borrowed by that particular person). Any suggestions
on how I might be able to achieve this? Thank you.
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Aravind wrote:
Hi folks.

I have a combo box with a list of names. I want to be able to click
(or press "enter" on) a name, which will open a separate form which
shows a group of records that corresponds to that name (e.g. "Borrow
History" table/query with its corresonding form, which holds the
details of books borrowed by that particular person). Any suggestions
on how I might be able to achieve this? Thank you.


It's quite simple.

Use the value from the ComboBox (eg. PersonID) and build a Where value
to open the form with.

eg. (VB code) Docmd.OpenForm "frmMyForm",,, "[PersonID] = " &
Me![cboSelectPersonID]

(Check the position of the Where clause in the Help, I've guessed the
commas./etc above :)

You can use a macro to achieve the same thing if that is easier for you.

eg. In the macro enter something like this for the Where value on the
OpenForm action

"[PersonID] = " & Forms![MyForm]![cboSelectPersonID]

Hope that gives you a start...
--
regards,

Bradley
Nov 12 '05 #2

P: n/a
I have a similar thing to this previously by setting up a 2 column table
which links the name of the combo box option to a string that can be
executed using the VBA "eval" function. This table is the rowsource for the
combo box. The string to be executed should be your function which opens
the form, eg:

FormOpen ("Borrow History")
Function FormOpen (strFormName)
docmd.openform strFormName
'Assume that the Form's recordsource query already uses the borrower
name on the
' same form that the combo box is on.
end function
--

If you want more details just e-mail me

Cheers,
Bob Bykerk,
Principal Consultant
InformatIQ Pty Ltd
+61 - (0)419 44 77 03
+61- (0)2 93652520

"Aravind" <so**********@hotmail.com> wrote in message
news:61**************************@posting.google.c om...
Hi folks.

I have a combo box with a list of names. I want to be able to click
(or press "enter" on) a name, which will open a separate form which
shows a group of records that corresponds to that name (e.g. "Borrow
History" table/query with its corresonding form, which holds the
details of books borrowed by that particular person). Any suggestions
on how I might be able to achieve this? Thank you.

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.