VBA Code errors out after creating a mde?

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"
 
D

Dirk Goldgar

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
 

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