null query problem

L

Leslie

I created a query to check for duplicate records so I could send the user a
message by way of a form I created. The sql is:

SELECT [ALL Policies].CustomerNo, [ALL Policies].ApplicationNo, [ALL
Policies].Carrier
FROM [Working Table] INNER JOIN [ALL Policies] ON ([Working Table].Carrier =
[ALL Policies].Carrier) AND ([Working Table].CustomerNo = [ALL
Policies].CustomerNo) AND ([Working Table].ApplicationNo = [ALL
Policies].ApplicationNo);

The code behind my button is:

If (Me.CustomerNo = Null) Then
DoCmd.Close "Duplicate"
DoCmd.RunMacro "Assign Macros.RetrieveInfo"
End If

When there is no match is both files, I thought I would get a null value in
the customerNo field. No matter what I do, it always has a customer number.
I want to close the "Duplicate" form is no match was found and procede with
the program. Anyone have any suggestions.
 
E

Erika

Try your code this way:

If IsNull(Me.[CustomerNo]) Then....

Hope it works and helps.
 
L

Leslie

Thanks for responding Erika.

my code does not regonize that the "Duplicate" form is open because it is a
pop-up form. Is there something special you do to close a pop-up form?

--
Leslie


Erika said:
Try your code this way:

If IsNull(Me.[CustomerNo]) Then....

Hope it works and helps.



Leslie said:
I created a query to check for duplicate records so I could send the user a
message by way of a form I created. The sql is:

SELECT [ALL Policies].CustomerNo, [ALL Policies].ApplicationNo, [ALL
Policies].Carrier
FROM [Working Table] INNER JOIN [ALL Policies] ON ([Working Table].Carrier =
[ALL Policies].Carrier) AND ([Working Table].CustomerNo = [ALL
Policies].CustomerNo) AND ([Working Table].ApplicationNo = [ALL
Policies].ApplicationNo);

The code behind my button is:

If (Me.CustomerNo = Null) Then
DoCmd.Close "Duplicate"
DoCmd.RunMacro "Assign Macros.RetrieveInfo"
End If

When there is no match is both files, I thought I would get a null value in
the customerNo field. No matter what I do, it always has a customer number.
I want to close the "Duplicate" form is no match was found and procede with
the program. Anyone have any suggestions.
 
E

Erika

No problem. Since it's a pop-up, I'm assuming it is the active object. You
may be able to just use DoCmd.Close and it will close the default object.
Otherwise (and to be safe), you must specify to access what type of object to
close, if you give it the name of the object. In your case it is a form, so
you have to give the value acform before the name of the form (DoCmd.Close
acform, "Duplicate"). Also, you may specify if you want to save the form or
not. The following example is from the Access Online Help (Type in
"DoCmd.Close" in Access Help to get information) and it is specifying to save
the form (if you don't specify, it will prompt):

Example
The following example uses the Close method to close the form Order Review,
saving any changes to the form without prompting:

DoCmd.Close acForm, "Order Review", acSaveYes

Good Luck.



Leslie said:
Thanks for responding Erika.

my code does not regonize that the "Duplicate" form is open because it is a
pop-up form. Is there something special you do to close a pop-up form?

--
Leslie


Erika said:
Try your code this way:

If IsNull(Me.[CustomerNo]) Then....

Hope it works and helps.



Leslie said:
I created a query to check for duplicate records so I could send the user a
message by way of a form I created. The sql is:

SELECT [ALL Policies].CustomerNo, [ALL Policies].ApplicationNo, [ALL
Policies].Carrier
FROM [Working Table] INNER JOIN [ALL Policies] ON ([Working Table].Carrier =
[ALL Policies].Carrier) AND ([Working Table].CustomerNo = [ALL
Policies].CustomerNo) AND ([Working Table].ApplicationNo = [ALL
Policies].ApplicationNo);

The code behind my button is:

If (Me.CustomerNo = Null) Then
DoCmd.Close "Duplicate"
DoCmd.RunMacro "Assign Macros.RetrieveInfo"
End If

When there is no match is both files, I thought I would get a null value in
the customerNo field. No matter what I do, it always has a customer number.
I want to close the "Duplicate" form is no match was found and procede with
the program. Anyone have any suggestions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top