Question Select a record from table

naym

Registered User.
Local time
Today, 16:46
Joined
Aug 30, 2006
Messages
47
Hi Guys,
I have a small issue,

I am trying to run a sql statement in vba in which it selects all the records in a table related to a order Id number.
I then want it loop through all the records and check for a check box which is selected.
if its selected then "A" variable becomes "1" and i will then run a if statement
saying if variable is 1 then run this code else run code b.

The problem I am having is that if there are 4 records the code checks through all of the 4 records and keeps changing the variable so
record 1 variable is 0
record 2 var is 0
" " " 1
" " " is 0

so although the records for a given order number does have a checked box the code wont recognise that.

Can yiu guys help me out on what i can do or what code i can add my minds gone all blank on this.

Thanks
 
SQL,
Code:
"Select * FROM YourTable WHERE OrderID =" & OrderID
This is assuming that OrderID is a number.

Code:
If YourCheckBox = True then
   Your code
ElseIf YourCheckBox =Fale then
    Your Other Code
End If
Unless there is some special reason for variable A, I would forget using it.

Dale
 
Thanks Dale,

I think I have resolved it.

what i was doing is:

after the do until eof

if rs(x).value = true then
Var A = 1
else
Var A = 0

so what it was doing is if the last record was false it would put false.
I just taken that after else part out and seems to be working ok now.

Thanks for the help tho
 

Users who are viewing this thread

Back
Top Bottom