Hi everyone,
I have this piece of VBA script:
' checking the DOB field to see if we constrain on the date
If Len(Me.EmpDOBTx t & "") > 0 Then
strWhere = strWhere & " AND [Employee].[DOB] <= #" & Me.DOBTxt &
"#"
End If
' check the Banking details fields
If Me.EmpVISAchk = True Then
strWhere = strWhere & " AND [Employee Banking].[VISA]=true"
End If
Basically, I am pulling back input from a form and using it to create
a whereCondition to feed into a report.
Problems:
1. The first piece of code checking DOB works, but only if the date
has a day that is 2 digits, ie. 30/06/2004. If you provide a date like
01/07/2004, it creates the SQL statement truncating the leading '0',
thus 1/07/2004. This then retuns no results when it should return the
same result as the other date entered, ie. 30/06/2004. Don't know why.
Both [Employee].[DOB] and Me.EmpDOBTxt are of Short date type.
2. If the user checks me.EmpVISAchk, when the code runs, a dialog box
is presented asking to provide parameter "[Employee Banking]". Again,
I have no idea why this is happening...... . I have tried encasing the
statement like:
(([Employee Banking].[VISA])=true)
and tried many different variations of 'true' - ie. -1, True, (1),
(-1).... I am also pretty sure that have no bound fields on my form,
but am not totally sure - how do you check this?
Any help very much appreciated.
Thanks,
A
I have this piece of VBA script:
' checking the DOB field to see if we constrain on the date
If Len(Me.EmpDOBTx t & "") > 0 Then
strWhere = strWhere & " AND [Employee].[DOB] <= #" & Me.DOBTxt &
"#"
End If
' check the Banking details fields
If Me.EmpVISAchk = True Then
strWhere = strWhere & " AND [Employee Banking].[VISA]=true"
End If
Basically, I am pulling back input from a form and using it to create
a whereCondition to feed into a report.
Problems:
1. The first piece of code checking DOB works, but only if the date
has a day that is 2 digits, ie. 30/06/2004. If you provide a date like
01/07/2004, it creates the SQL statement truncating the leading '0',
thus 1/07/2004. This then retuns no results when it should return the
same result as the other date entered, ie. 30/06/2004. Don't know why.
Both [Employee].[DOB] and Me.EmpDOBTxt are of Short date type.
2. If the user checks me.EmpVISAchk, when the code runs, a dialog box
is presented asking to provide parameter "[Employee Banking]". Again,
I have no idea why this is happening...... . I have tried encasing the
statement like:
(([Employee Banking].[VISA])=true)
and tried many different variations of 'true' - ie. -1, True, (1),
(-1).... I am also pretty sure that have no bound fields on my form,
but am not totally sure - how do you check this?
Any help very much appreciated.
Thanks,
A
Comment