PDA

View Full Version : Form to run query



mdmackillop
03-27-2005, 06:37 AM
It's been a while since I did any Access so looking for basic assistance here.
The StatusQuery form is to allow a user to get any combination of Status values (0, 1, 2 or 3) from the ContractDetails table.
1 - Is this the right approach?
2 - If so, can you spot the problem?

smozgur
03-27-2005, 08:23 AM
It's been a while since I did any Access so looking for basic assistance here.
The StatusQuery form is to allow a user to get any combination of Status values (0, 1, 2 or 3) from the ContractDetails table.
1 - Is this the right approach?
2 - If so, can you spot the problem?

Hi,

I edited my post to remove completely wrong approach so it wouldn't take place anymore :). Sorry, if you read it before I delete it.

I was wrong. I thought that Status values are supposed to be stored as combination of totals of selections. Now I see that it is supposed to retrieve different Status valued records...


However;
In your database, in MakeSQL function, following line has a syntax error :

TotVal = MtVal0 + MyVal1 + MyVal2 + MyVal3

MtVal0 should be MyVal0.

Also DoCmd.RunSQL SQL wouldn't work for SELECT queries, so it will create the correct SQL string that you would need but you should assign this SQL string as Record Source to another form (for example a subform in this main form) to retrieve & display queried records.

I attached a modified version of your DB by using my suggestiong above.

Suat

mdmackillop
03-27-2005, 09:00 AM
Hi Suat,
Thanks for that. It answers my query and I can use the subform approach easily in my project.
Regards
Malcolm

smozgur
03-27-2005, 09:31 AM
Hi Suat,
Thanks for that. It answers my query and I can use the subform approach easily in my project.
Regards
Malcolm

Glad to hear it helps, Malcolm!

Suat