If Help needed

D

Dave Elliott

I have this code on the on current event of my form. It does not work and
wont let me save or proceed.
I am trying to check if Text388 has a value greater than 0 then Due, which
is a yes/no control with its format set to True/False
and Default value set to True change and save the record afterwards.

If (Me.Text388) > 0 Then Me.Due = False
 
G

Graham R Seach

Try expressly coercing the value to a number:
If Val(Me!Text388) > 0 Then Me!Due = False

If that doesn't work, it could be a timing issue, which means Text388 has
not yet been assigned a value, although by the Current event it should have.
Try this:
If Nz(Me!Text388, 0) > 0 Then Me!Due = False

If that doesn't work, is Text388 getting its value straight from teh
table/query, or is it being calculated in code/macro?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 
D

Dave Elliott

How can I make the record save itself after the update automatically?
Right now now the record naturally opens in the pencil or edit mode when the
code runs and the variable is true.
 
G

Graham R Seach

Dave,

It will save itself when you move to a different record, or when you close
the form. But if you want to force a save, the easiest way is to issue the
following:
Me.Dirty = False

But I'm always more comfortable with the following:
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdSaveRecord

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
 

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