N
NKK
Hello,
I have a form with a command button and an on-click event that runs the
following (there is a little more after the stop, but it is immaterial to
this question)
Private Sub cmdSetupNBS_Click()
Dim strwhereclase As String
Dim strformname As String
Dim db As Database
Dim rst As Recordset
Dim strsql As String
Dim msg As String
strwhereclause = "account_type_id = 'NBS'"
strsql = "SELECT dt_Accounts.Account_id FROM dt_Accounts "
strsql = strsql & "WHERE (((dt_Accounts.Account_setup)= 0) "
strsql = strsql & "AND ((dt_Accounts.Ready_to_create)= -1) "
strsql = strsql & "AND ((dt_Accounts.Account_type_id)='NBS'))"
Set db = CurrentDb
Set rst = db.OpenRecordset(strsql, dbOpenDynaset)
Debug.Print rst.RecordCount
Stop
I am getting 587 records in my recordset, however when I run the query via
the access query designer, I only get 4; 587 is the total number of records
that fit the last criteria (account_type_id = "NBS") so I am pretty sure my
syntax is off on the other two criteria. I have those fields set up in the
table as Yes/no fields with a format of yes/no. I have tried the following
values for ready_to_create and account_setup and keep getting the 587 record
count...
True, False
Yes, No
'yes', 'no'
-1, 0
What am I missing?
I have a form with a command button and an on-click event that runs the
following (there is a little more after the stop, but it is immaterial to
this question)
Private Sub cmdSetupNBS_Click()
Dim strwhereclase As String
Dim strformname As String
Dim db As Database
Dim rst As Recordset
Dim strsql As String
Dim msg As String
strwhereclause = "account_type_id = 'NBS'"
strsql = "SELECT dt_Accounts.Account_id FROM dt_Accounts "
strsql = strsql & "WHERE (((dt_Accounts.Account_setup)= 0) "
strsql = strsql & "AND ((dt_Accounts.Ready_to_create)= -1) "
strsql = strsql & "AND ((dt_Accounts.Account_type_id)='NBS'))"
Set db = CurrentDb
Set rst = db.OpenRecordset(strsql, dbOpenDynaset)
Debug.Print rst.RecordCount
Stop
I am getting 587 records in my recordset, however when I run the query via
the access query designer, I only get 4; 587 is the total number of records
that fit the last criteria (account_type_id = "NBS") so I am pretty sure my
syntax is off on the other two criteria. I have those fields set up in the
table as Yes/no fields with a format of yes/no. I have tried the following
values for ready_to_create and account_setup and keep getting the 587 record
count...
True, False
Yes, No
'yes', 'no'
-1, 0
What am I missing?