Query from form - again!

  • Thread starter Gil Lopes via AccessMonster.com
  • Start date
G

Gil Lopes via AccessMonster.com

Hi folks! Sorry, but I really need urgent help.

I have a table with the following fields:
Date info1 info2 info3 info4 info5

I made a query where I want to search for:
Date Infoselected

The field (besides date) to show on the query field would be chosen by the
user in a form.
My problem is to insert the correct (selected) field in the query, making a
valid expression that collects the field from the form.
Tryed to read the older topics, but I can' t get enough help from them.

Any help is much appreciated.
Sorry for all the urgency.

Regards,

Gil
 
D

Duane Hookom

If the information fields are similar (not normalized) then I would create a
union query:
SELECT [Date], Info1 As Info, 1 as Num
FROM tblWithFollowingFields
UNION ALL
SELECT [Date], Info2 , 2
FROM tblWithFollowingFields
UNION ALL
SELECT [Date], Info3 , 3
FROM tblWithFollowingFields
UNION ALL
...etc...;

Then allow the users to select the fields based on hte Num field which had
been a column.

Otherwise use the Choose() function:

Choose([Enter Field Number], Info1, Info2, Info3, Info4, Info5)
 
Top