Run apdate query

G

Guest

I have a Form. On its close event a update query is run if a field has a
value more than 0 (zero) Example below:
If Me.WorkOrderID > 0 Then
stDocName = "QryRequisitionDetailstoParts"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Else
End If

However what code must I insert to have the query not run if the value in
the field is null or is 0

help
 
E

Ed Metcalfe

Levans digital said:
I have a Form. On its close event a update query is run if a field has a
value more than 0 (zero) Example below:
If Me.WorkOrderID > 0 Then
stDocName = "QryRequisitionDetailstoParts"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Else
End If

However what code must I insert to have the query not run if the value in
the field is null or is 0

help

You don't have to insert any code to *not* print the report. What you have
should work.

BTW - You don't need the "Else" in your If block, as you're not doing
anything if the value is >0.

Ed Metcalfe.
 
G

Guest

Add to your criteria the Nz function to replace the Null with 0, so the
query wont run

If Nz(Me.WorkOrderID,0) > 0 Then
stDocName = "QryRequisitionDetailstoParts"
DoCmd.OpenQuery stDocName, acNormal, acEdit
End If
 
G

Guest

THANKS VERY MUCH YOU GUYS. IT WORKS GREAT

Ofer Cohen said:
Add to your criteria the Nz function to replace the Null with 0, so the
query wont run

If Nz(Me.WorkOrderID,0) > 0 Then
stDocName = "QryRequisitionDetailstoParts"
DoCmd.OpenQuery stDocName, acNormal, acEdit
End If
 

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

Similar Threads


Top