Runtime Error 94 when entering a new record

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