How do I add the visual basic AddAllToList() Function to a form: Idiot's guide please !

I would like to be able to use the Addalltolist function described here :
http://support.microsoft.com/?kbid=210290

However when it comes to Visual Basic I know about as much as a particularly dumb muppet.

I've tried following the instructions that the microsoft article gives. I've opened a form, selected one of the comboboxes in which I would like to have an "All" option into and then clicked on "Code".

Visual Basic opens up and I've tried pasting all the code from microsoft's article at the bottom of the screen full of visual basic code that already exists (from macros I've written I assume).

When I do that and then press compile the following gets highlighted "Static DB As Database, RS As Recordset" and a message box states that User defined type not defined.

I've also tried right clicking and creating a Class Module where I pasted some stuff. That broke my database (fear not I backed it up).

Can anyone give me an idea of what I'm doing wrong and how I can make things work. I know its a bit of a challenge but I really need the functionality that the microsoft article suggests I could get. I've tried playing with union queries but that's not going so well either !


 
DanSeal100Asked:
Who is Participating?
 
puppydogbuddyConnect With a Mentor Commented:
change:
Static DB As Database, RS As Recordset
To:
Static db As DAO.Database, rs As DAO.RecordsetStatic db As DAO.Database, rs As DAO.Recordset

0
 
seameadowConnect With a Mentor Commented:
You also need to add a reference to a DAO library. The default Access references include only ADO. To do this, open any code in the code editor. Then:
1. Select Tools > References from the menu. You will see 4 or 5 library references already checked.
2. Scroll down through the unchecked references. Look for "Microsoft DAO X.y Object Library, where X.y is a version number such as 3.5 or 3.6.
3. Check the highest version number that you see.
4. Click OK.
5. Use Debug / Compile [projectname] to compile your code

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.