Re: VB Access to Run SQL SELECT query



Great, thanks for the repliedHow could I write a SELECT statement in
the VB code that would be appropriate to capture the wanted fields? I
tried using the DoCmd.RunSQL "SELECT..." but the RunSQL statement only
runs SQL action queries, not SELECT. Or is there a way to write "if"
statements in the SQL view of the query designer in MS Access?

Thanks a bunch, Daryl

DavidB wrote:
True is stroed as -1, false is stored as 0. That should give you the
info you need.


On Jul 16, 5:01 pm, Chuck <libb...@xxxxxxxxxxxxxx> wrote:
On Mon, 16 Jul 2007 17:18:40 -0000, "The.Daryl...@xxxxxxxxx"





<The.Daryl...@xxxxxxxxx> wrote:
Hi,

Have a bit of a problem... I've created a form in Access and will use
the form for a user to query a table based on the selected fields.
The problem lies in that I was using checkboxes for the fields and
noticed that if I don't check a box, then the query will look
specifically in the table for where the applicable field is FALSE.
This isn't right however and decided that I should use a radio button
group so that the user can select either TRUE, FALSE, or Any. This
way the user can select all the records from a table without excluding
TRUE if the checkbox is not selected or FALSE if the checkbox is
selected. Now, because I'm using a radio group button and have to
have this "Any" selection, how do I write the code that would SELECT
from the table both TRUE and FALSE? I suppose excluding this field
from the WHERE part of the SQL statement will then find all the
records but I'm having trouble now with the SELECT statement and using
the DoCmd.RunSQL "SELECT * FROM tblWhatever WHERE ID=..." I'm also
unsure of how to pull in the fields from the form.

Using the DesignView to create a query in Access is easy but when you
have to code it with VB(A) due to the "Any" value makes this problem a
bit harder. Any tips is greatly appreciated.

Thanks,
Daryl

"Any" = *

Chuck
--- Hide quoted text -

- Show quoted text -

.