Run apdate query

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
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
 
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
 
Back
Top