.visible giving strange results in on current event

BarryMK

4 strings are enough
Local time
Today, 10:59
Joined
Oct 15, 2002
Messages
1,349
The first piece of code works fine on my main form but when I replace it with the second code I get "Compile error - method or data member not found" breaking on '.visible'

What's really frustrating is that both codes work either separately or combined together on a brand new form with just the listed controls on it.

Any ideas people?

'Code 1
Private Sub Form_Current()
If IsNull(ActionDesc) Then
Me.lblAction.Visible = True
Else
Me.lblAction.Visible = False
End If
End Sub


'Code 2

Private Sub Combo45_AfterUpdate()
If IsNull(IncidentIDold) Then
Me.IncidentIDold.Visible = False
Me.IncidentID.Visible = True
Else
Me.IncidentID.Visible = False
End If
If Not IsNull(IncidentIDold) Then
Me.IncidentIDold.Visible = True
Else
Me.IncidentIDold.Visible = False

End If
 
Private Sub Combo45_AfterUpdate()
If IsNull(IncidentIDold) Then
Me.IncidentIDold.Visible = False
Me.IncidentID.Visible = True
Else
Me.IncidentID.Visible = False
Me.IncidentIDold.Visible = True

End If
 
Rich Thanks for the reply. I posted this at the end of a somewhat stressfull day, what I didn't make clear is that I'm using it in the On Current event of the form not in a combo box After Update as per the example. Both my and your codes bring up the error here. What baffles me is that the error on .visible doesn't appear with the first piece of code. Doh!
 
Couple of things Barry,

Get into the habit of changing the default name that Access gives your control to something else ie
Me.txtIncidentID.Visible instead of Me.IncidentID.Visible

Also, Are you trying to hide a control that has the focus?
 
Hi Fizz, how's things?

Re the naming I do what you say already, the only exception being for ID numbers, can't think why though!

The form opens with focus on another field so it isn't that. Could it be due to fact that the IncidentID field is an autonumber?
 
Good thanks, just been away far too long!

Autonumber should make no differece as all you are hiding is the control.
Sorry about the renaming lecture - one of your quirks, not renaming the ID field, surely that must say something about you ;)

The other option is not a good one (and hopefully not your problem!)

Do you run A2k? If so, are you updated to SP3. If not, there is a major flaw in A2k where forms and code can get horribly corrupt, so upgrade to SP3 ASAP.

I would be tempted to import all objects etc into a clean Db and see if the code works there.
 
Fizzio said:
Good thanks, just been away far too long!

Sorry about the renaming lecture - one of your quirks, not renaming the ID field, surely that must say something about you ;)

You may be right :)
Fizzio said:
The other option is not a good one (and hopefully not your problem!)

Do you run A2k? If so, are you updated to SP3. If not, there is a major flaw in A2k where forms and code can get horribly corrupt, so upgrade to SP3 ASAP.
No I'm running A97 on Win2k

Fizzio said:
I would be tempted to import all objects etc into a clean Db and see if the code works there.

Been there - done that - didn't work :confused:

Perhaps there's something else on the form that's upsetting it. I think, as it's not a life and death matter I'll just put it down to Access 1- BMK nil, but thanks for the help Fizzio and good to see you back.
 
Fixed it!

Fizzio - I lied I didn't give up I tried one more ploy. I copied the form contents onto a new blank form, bunged in your code and it works. These forms have been worked on considerably over time. I wonder if they just get "clogged up" or bloated somehow, say with deleted code and reach a point where they corrupt?
 
Glad to see you came clean eventually ;)

I get into the habit of occasionally importing into a 'fresh' Db just to keep this bloat down and always before distributing a new FE.

Glad it is sorted :)
 

Users who are viewing this thread

Back
Top Bottom