"Anchor" command buttons to scroll continuous form?

natsirtm

Registered User.
Local time
Today, 12:01
Joined
Apr 30, 2007
Messages
57
I would like to create some command buttons to making scrolling through a long continuous form simpler.

As anchor tags in HTML, listing each letter of the alphabet and when clicked would scroll the form down to the first record beginning with that letter.

Been googling but can't seem to find the right search term.

Can anyone point me in the right direction?
 
You can't anchor like that in VBA. What you do is put your A-Z buttons in the form header or footer (make sure they're visible -- View -> Form Header/Footer) and you place the continuous part in the form's Detail section, or you put the continuous forms section into a subform and have the A-Z buttons on the main form.
 
I'm fine with putting the buttons in the form header, but what action do I make the buttons do to scroll the detail part?
 
Buttons to scroll the detail? I'm a little confused here. The vertical scrollbar should be there (enable it on the detail section if it's not), and if it's not, the mousewheel should be fine.

I'm not sure exactly what you're talking about though. It looks like you left a word or two out of the question.
 
The problem is the list is thousands of records long.

I want to place a row of buttons along the top of the form, one for each letter of the alphabet. Then you could click "M" for example and it would scroll the continuous form down to the first record beginning with "M"

Like how you could use anchor tags in HTML.
Here's an example.

http://www.dlt.ri.gov/Unit.htm
 
On the recordset in the detail, just do a find. In your example, you would use a Find command to search on the field that the A-Z buttons refer to (a name, a company, or whatever), and Access will automatically scroll to that for you. Just make sure you use a "like" in your find, as in Like "M*". That will find the first entry with an M as the first letter and automatically scroll to it.
 
That looks good Maurice.

I am getting an error when i click a button
"The object doesn't contain the Automation object "RecordsetClone"

Is it just the macro which handles everything? I can't find anything to do with the RecordsetClone anywhere (no modules, not in form code)

What/Where is the Automation Object? (Funnily enough it still works :S)
 
That looks good Maurice.

I am getting an error when i click a button
"The object doesn't contain the Automation object "RecordsetClone"

Is it just the macro which handles everything? I can't find anything to do with the RecordsetClone anywhere (no modules, not in form code)

What/Where is the Automation Object? (Funnily enough it still works :S)

Good morning

Maybe you should check the References. Yes, the Macro handles everything.

Best regards

Maurice
 
I don't see any "MISSING" references in your database.

The following are checked;
- Visual Basic for Applications
- Microsoft Access 11.0 Object Library
- OLE Automation
- Microsoft ActiveX Data Objects 2.1 Library.

Would just like to note the error is actually appearing in your example database. Any ideas?
 
I don't see any "MISSING" references in your database.

The following are checked;
- Visual Basic for Applications
- Microsoft Access 11.0 Object Library
- OLE Automation
- Microsoft ActiveX Data Objects 2.1 Library.

Would just like to note the error is actually appearing in your example database. Any ideas?

Hi again

How about performing a simple Repair / Compact? - Can't imagine what's wrong, there's not much of anything in the database.

Maurice
 
For anyone wondering, I found the cause of the error message.
Has to do with Macro Security Levels/Sandbox mode. Looks like RecordsetClone is on the "flagged" list.

Here's where I initially found the answer
http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=1168248&SiteID=17

and here is a much better explanation with more options
http://www.vb123.com/toolshed/04_docs/sandbox.htm

Unfortunately, having the macro security levels set to low won't do for this application, and I couldn't quickly find a way to change them with VB code which I could manage - so I guess this functionality will get put on the shelf.
 

Users who are viewing this thread

Back
Top Bottom