Runtime Error 94 when entering a new record

B

Bellyjeans

Hi all,

I have two text boxes in a form that are only visible if their
respective check boxes are clicked. The coding on the After Update
event of the check boxes is as follows:

Check box one:

Me.txtOne.Visible = Me.chkOne


Check box two:

Me.txtTwo.Visible = Me.chkTwo

I then have the following code on the form's On Current event:

Me.txtOne.Visible = Me.chkOne
Me.txtTwo.Visible = Me.chkTwo

The problem is when I create a new record. My error looks like "94 -
Invalid Use of Null - Form_Current()". Where am I going wrong on my
form's On Current event?

Thanks in advance.
 
D

Douglas J. Steele

I'm guessing that one or both of the check boxes aren't initialized (that
they're showing up as Gray, not White or Checked).

Try:

Me.chkOne = False
Me.chkTwo = False
Me.txtOne.Visible = Me.chkOne
Me.txtTwo.Visible = Me.chkTwo

or

Me.txtOne.Visible = Nz(Me.chkOne, False)
Me.txtTwo.Visible = Nz(Me.chkTwo, False)
 
B

Bellyjeans

I'm guessing that one or both of the check boxes aren't initialized (that
they're showing up as Gray, not White or Checked).

Try:

    Me.chkOne = False
    Me.chkTwo = False
    Me.txtOne.Visible = Me.chkOne
    Me.txtTwo.Visible = Me.chkTwo

or

    Me.txtOne.Visible = Nz(Me.chkOne, False)
    Me.txtTwo.Visible = Nz(Me.chkTwo, False)

--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)















- Show quoted text -

It worked. Thanks Doug! You always give such great advice.
 

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