Alpha Buttons Macro

johnsqftwr

Registered User.
Local time
Today, 13:30
Joined
Jul 19, 2004
Messages
29
Hi,

I have been using the Alpha Buttons Macro in Access 2002 with no problems. I have now updated to Access 2007. The Macro still works, but when I click on a button I get an error message The object doesn't contain the Automation object 'RecordsetClone'

How can I remove the error message?

Many thanks

John
 
Few people here use macros, with the exceptions of AutoExec and AutoKeys, so I don't know what Apha Buttons Macro does, but I do know, from a post of Allen Browne's I've seen, that ACC2007 doesn't always recognize RecordsetClone. Maybe if you could give us the code in the macro, or exactly what it does, someone here could offer you an alternative.
 
Many thanks for response. I have deleted the Macro and included the following code:

Private Sub btnA_Click()
On Error GoTo Err_btnA_Click


Me.FilterOn = True
DoCmd.ApplyFilter , "fieldName like 'A*'"
Exit_btnA_Click:
Exit Sub

Err_btnA_Click:
MsgBox Err.Description
Resume Exit_btnA_Click

End Sub


Etc., for each Alpha button.
 
Always better to use code, and this seems to work just fine! I wonder what the reference to RecordsetClone was for?
 
I am not sure what the reference was for, but I just used the example from an old Northwind Database 3 or 4 years ago.

I do have a form which opens subforms based on whether there are any records in the sub form using RecordsetClone and this works fine.

Private Sub Form_Current()
With Me![Club 2nd XI Subform].Form
.Visible = (.RecordsetClone.RecordCount > 0)
End With
With Me![Club 1st XI Subform].Form
.Visible = (.RecordsetClone.RecordCount > 0)
End With


End Sub
 
As I remember Allen saying, in 2007 it works in some places and not others. Apparently it doesn't like old macros and I seem to remember it doesn't work from within the Property box either, as if you were trying to use it in the control source or default value of a control.
 
Many thanks for response. I have deleted the Macro and included the following code:

Private Sub btnA_Click()
On Error GoTo Err_btnA_Click


Me.FilterOn = True
DoCmd.ApplyFilter , "fieldName like 'A*'"
Exit_btnA_Click:
Exit Sub

Err_btnA_Click:
MsgBox Err.Description
Resume Exit_btnA_Click

End Sub


Etc., for each Alpha button.

Hi Johnsq.
I am a bit of a newbie. I am a bit confused as to where to put this code.
Is it on the form or the option group or the individual buttons ??

Regards Dave Field
 
Hi,
Have a look at my attached alphafilter example I did for other people it can be used in multiple forms etc. Searching is also catered for. I hope this helps you.
The attached database is in 2003 version but it has been used in 2007/10.

Regards
Tony
 

Attachments

Hi,
Have a look at my attached alphafilter example I did for other people it can be used in multiple forms etc. Searching is also catered for. I hope this helps you.
The attached database is in 2003 version but it has been used in 2007/10.

Regards
Tony

Thanks Tony. I will have a look at this at work where I have Access 2003
I only have 97 at home! Regards Dave
 
What would be the code for the ALL button (to display all records) at the end of the alpha buttons?

Also, if I wanted to group certain letters together - like 'XYZ' would I use the following code:

Private Sub btnXYZ_Click()
On Error GoTo Err_btnXYZ_Click


Me.FilterOn = True
DoCmd.ApplyFilter , "fieldName like 'XYZ*'"
Exit_btnXYZ_Click:
Exit Sub

Err_btnXYZ_Click:
MsgBox Err.Description
Resume Exit_btnXYZ_Click

End Sub
 
Hi Tophan

If you want to show all records try this..make sure the 'ALL' button is named btnAll
Private Sub btnAll_Click() 'Show all records
DoCmd.ShowAllRecords
End Sub

The sub to group entries beginning with several letters you suggested would only work if entries in the field began with 'XYZ' followed by something.

Try this: ( in this case it groups together any entries starting with A,B or C )
Obviously create and name the button appropriately, and the code sequence starting "DoCmd.."and ending "like'C*'" should be all on one line


Private Sub btnABC_Click()
On Error GoTo Err_btnABC_Click
Me.FilterOn = True
DoCmd.ApplyFilter , "CompanyName like 'A*'OR CompanyName like 'B*'OR CompanyName like 'C*'"
Exit_btnABC_Click:
Exit Sub

Err_btnABC_Click:
MsgBox Err.Description
Resume Exit_btnABC_Click

End Sub

Good Luck Dave
 
Thanks...I will try this over the weekend. Technically my database is complete but I am always looking for ways to improve it so I will try with a test copy and let you know if I am successful :)
 

Users who are viewing this thread

Back
Top Bottom