Query with date values

exaccess

Registered User.
Local time
Today, 14:21
Joined
Apr 21, 2013
Messages
287
Hello Experts,
Please could anyone tell me what is wrong with the code below. It throws an error of application:
Code:
If (Not IsNull(Forms(ForName).F03)) And (Forms(ForName).F03 <> "") _
       And (Not IsNull(Forms(ForName).V03)) And (Forms(ForName).V03 <> "") Then
This code is in a module called by a number of programs. F03 contains a field name as text and V03 contains a date value. Thanks.
 
your 'forms' is wrong, you need the full path:

forms!FORNAME!f03
 
your 'forms' is wrong, you need the full path:

forms!FORNAME!f03

Hi Ranman,
That does not work either. Here ForName is a variable that contains the form's name it is not the name itself.
 
dim strF03 AS STRING
dim strV03 AS STRING

strF03 = Forms(forName).Controls("FO3").Value & ""
strV03 = Forms(forName).Controls("vO3").Value & ""

If (strF03 <> "") And (strV03 <> "") Then
 
dim strF03 AS STRING
dim strV03 AS STRING

strF03 = Forms(forName).Controls("FO3").Value & ""
strV03 = Forms(forName).Controls("vO3").Value & ""

If (strF03 <> "") And (strV03 <> "") Then

Thanks it works in its present format, it was a logic problem. There was no syntax error, the "AND"s should have been "OR"s. That was why it was saying application error. I should have thought about it before. Sorry to bother.
 
then let the variable to the form to resolve
 

Users who are viewing this thread

Back
Top Bottom