VBA Code errors out after creating a mde?

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

Codes works fine in mdb, but not in mde?
This is on the On Close Event of the form, the form has a close button on
it.
What can I change?

DoCmd.SetWarnings False
[Forms]![frmAutoPayrollReport]![Customer] = Null
[Forms]![frmAutoPayrollReport]![Client] = Null
[Forms]![frmAutoPayrollReport]![Status] = 1
[Forms]![frmAutoPayrollReport]![QuotInv] = Null
[Forms]![frmAutoPayrollReport]![TimeCounter] = Null
[Forms]![frmAutoPayrollReport]![CustJobNo] = Null
[Forms]![frmAutoPayrollReport]![CustPONo] = Null
DoCmd.Close acForm, , "TimeCards"
 
Dave Elliott said:
Codes works fine in mdb, but not in mde?
This is on the On Close Event of the form, the form has a close
button on it.
What can I change?

DoCmd.SetWarnings False
[Forms]![frmAutoPayrollReport]![Customer] = Null
[Forms]![frmAutoPayrollReport]![Client] = Null
[Forms]![frmAutoPayrollReport]![Status] = 1
[Forms]![frmAutoPayrollReport]![QuotInv] = Null
[Forms]![frmAutoPayrollReport]![TimeCounter] = Null
[Forms]![frmAutoPayrollReport]![CustJobNo] = Null
[Forms]![frmAutoPayrollReport]![CustPONo] = Null
DoCmd.Close acForm, , "TimeCards"

That last line shouldn't work in an MDE *or* and MDB. "TimeCards" is
not a proper value for the third argument of the DoCmd.Close method.
That argument expects an integer numeric value; what do you intend by
passing a string?

Are you trying to close a form named "TimeCards"? If so, that should be
the second argument to DoCmd.Close, not the third, as with

DoCmd.Close acForm, "TimeCards"

If "TimeCards" is the current form, the one on which this code is
running, you could also write the line this way:

DoCmd.Close acForm, Me.Name
 
Back
Top