Generic Query?

C

cjohns38

When I create a db I normally create two tables, one called groups,
and the other called lookup. The Groups table contains a GroupID
(PrimaryKey_AutoNumber) and a Group Description (textfield). The
lookup table contains LookupID (PrimaryKey_AutoNumber) Group (Lookup
vale from groups table) and Lookup_Description (text field). The idea
is that I can add as many groups and lookup values as I need to for
dropdowns. It also allows me to be a little more flexible if I need to
make changes. Then, when I create a form I can create a query on the
lookup table that limits based on groupID. It may not be perfect but
it’s the habit I’ve gotten into.

The problem I have is that I’m reinventing the wheel with each query.
For example, right now I’m creating a form that is going to require
30+ fields with dropdowns. That means I’m going to need to create 30
queries limited based on group id. That seems a little redundant
given it’s the same query with a different groupid. My question is
this, is there a way to create a generic query and have the correct
groupid passed into the query for each field? If so……how do I do that?

I’m using access 2003 and I have limited skills so don’t get to fancy
on me. Thoughts?
 
M

MGFoster

cjohns38 said:
When I create a db I normally create two tables, one called groups,
and the other called lookup. The Groups table contains a GroupID
(PrimaryKey_AutoNumber) and a Group Description (textfield). The
lookup table contains LookupID (PrimaryKey_AutoNumber) Group (Lookup
vale from groups table) and Lookup_Description (text field). The idea
is that I can add as many groups and lookup values as I need to for
dropdowns. It also allows me to be a little more flexible if I need to
make changes. Then, when I create a form I can create a query on the
lookup table that limits based on groupID. It may not be perfect but
it’s the habit I’ve gotten into.

The problem I have is that I’m reinventing the wheel with each query.
For example, right now I’m creating a form that is going to require
30+ fields with dropdowns. That means I’m going to need to create 30
queries limited based on group id. That seems a little redundant
given it’s the same query with a different groupid. My question is
this, is there a way to create a generic query and have the correct
groupid passed into the query for each field? If so……how do I do that?

I’m using access 2003 and I have limited skills so don’t get to fancy
on me. Thoughts?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You could put the group id in the ComboBox's Tag property and then use a
where clause like this:

WHERE groupID = Screen.ActiveControl.Tag

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBShNAZoechKqOuFEgEQL8yACgrkcZonEQfFmjq1VRui4ptRBh+rgAoMft
OLntZigPzGH7AOsFK0BZizmc
=ueOU
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top