Need to store 2 values from combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am displaying code and name in combo box using select statement like

Select empcode, empname from employee

Upon selection of the code and name, I want to pass on both the values
to other form.

What is the best way to do so?

I am able to pass only one of the values? I don't know how I can pass both

Thank you for your help!
-Me
 
You've described "how" you have decided to do something (pass two values to
another form). If you'll describe "why" you have chosen this approach, and
"what" having two values in another form will allow you to do, the folks
here in the 'group may be able to offer more specific suggestions.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Hi Jeff,

I have chosen this approach 'cause on the next form, I want to add more
records
for this employee. So I want to be able to see the empcode and name
on top of the form.

Thank you,
-Me
 
So, here's another way to accomplish the same thing (if I'm understanding
what you are trying to do)...

Create one form (your "main" form), on which you get/have [empcode] and
[empname].

Create another form (a "subform") on which you have the related records.

Note that this approach assumes you have a one-to-many table structure ...
one employee may have many "other records" (whatever you are recording in
those).

Now open the main form in design view, and add the "subform" as a subform.
Access will prompt you to help it figure out how these are related. Again,
note that this will require the "one" and the "many" tables to be related --
i.e., the "many" table will need a foreign key field to point back to the
record in the "one" table that owns (each) "many" record.

Now, open the "main" form, select an employee, and you see that employee's
"many" records in the subform!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I am displaying code and name in combo box using select statement like

Select empcode, empname from employee

Upon selection of the code and name, I want to pass on both the values
to other form.

What is the best way to do so?

I am able to pass only one of the values? I don't know how I can pass both

Thank you for your help!


Once you get the idea behind data normalization, you'll be
much better armed to use a relational database management
tool like MS Access.
 
Back
Top