Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Method or Data Member not found

Status
Not open for further replies.

smalty

Technical User
Jan 9, 2005
74
0
0
GB
I am using the following code to Disable the custom First, Last and New Record buttons but receive an error message when I press one of those buttons and being relatively new, do not understand why. Could someone explain please?

The code is
Private Sub Form_Current()
On Error Resume Next
If Me.CurrentRecord = 1 Then
Me.cmdPrevious[highlight #729FCF].Enabled =[/highlight] False
Else
Me.cmdPrevious.Enabled = True
End If
If Me.CurrentRecord >= Me.Recordset.RecordCount Then
Me.cmdNext.Enabled = False
Else
Me.cmdNext.Enabled = True
End If
If Me.NewRecord Then
Me.cmdNewRecord.Enabled = False
Else
Me.cmdNewRecord.Enabled = True
End If
End Sub[highlight #729FCF][/highlight]

The error is 'Compile Error - Method or Data Member not found' with the first '.Enabled' highlighted

Regards
Smalty
 
When you type your code and have: [tt]Me.cmdPrevious.[/tt] - do you get the intelisense list of properties and is Enabled one of them?

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
The intelisense list does appear but 'Enabled' is not in the list!!!!!
 
The question might appear banal but:
what sort of control are cmdPrevious etc. actually? Buttons?

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
It's just a 'graphic (png file)' which I am using as a 'button'
 
What about the Visible property ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yes 'Visible' works except that the button disappears rather than gets 'greyed out'. I suppose I am just being a bit fussy although it would be good to know if 'Enabled' should work on imported graphics. Should it???????

Anyway appreciate your time looking at it for me......thanks

Smalty
 
A graphic in itself is not "able" - it is visible or it is not.
You could simulate an "enabled/disabled" feature for it if you subtituted it with a greyed-out/desaturated version of the graphic for "disabled" and e.g. set a hidden field to a certain value for which you can check before executing your OnClick action. Not exactly elegant though.

I'm a bit out of exercise with Access Forms, but isn't there an "ImageButton" equivalent which you could use for that? If I'M not mistaken you can set a button to style "graphic" and assign it an image, right?
That would give you an Enabled/Disabled property, no sweat.

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Thanks for your time and suggestion

I've gone with the Visible option and used a 'greyed out' version of the same image beneath the original. Works perfectly well as expected.

I was just interested as the I got the original code from a tutorial which was describing how to create these 'buttons' using custom graphics.

I live and learn every day

Thanks

Smalty

 
I'm a bit out of exercise with Access Forms, but isn't there an "ImageButton" equivalent which you could use for that? If I'M not mistaken you can set a button to style "graphic" and assign it an image, right?
That would give you an Enabled/Disabled property, no sweat.

That is correct, you change buttons to use a 'picture' and then you get all button control properties.

The caveat I have found when I do this is it is best to use an image control to get the image imported and set its picture type property to 'shared', this then makes it available to the button in the picture drop down selection. You can then delete the actual picture control from the form.

Doing this ensures Access lets you use images with transparency and the image quality is also maintained. If you just select the image direct, I have found access doesn't always accept the image or if it does, it seriously degrades quality and the transparent 'button' effect you want is also lost.

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top