PDA

View Full Version : Importing VBA Userforms into Access DBs



Dr.K
07-17-2008, 12:04 PM
Why is this so difficult?
Everytime I go to import a VBA form, I have problems with the names and objects, and then my Access DB doesn't save correctly, and I lose all my work.

And why can't I insert a blank VBA form? The method I'm using now is to import a blank VBA form (exported from Excel VBA), and then modify it in the Access VBA screen.

Am I only supposed to use Access forms in Access VBA?

CreganTur
07-17-2008, 12:34 PM
I'm afraid that we're going to need a little more information on exactly what you're trying to do.


Everytime I go to import a VBA form
What exactly do you mean by VBA Form? Are you trying to import a Form from a different Access Database, or are you talking about UserForms, which are used in Word, Excel, etc.?


I have problems with the names and objects
Are you certain that you have the correct references needed to support all of the objects and methods used?


why can't I insert a blank VBA form
If you're in Access you should just be able to, on the Database window, click Forms -> New to create a new, blank form.

Dr.K
07-17-2008, 01:34 PM
I'm afraid that we're going to need a little more information on exactly what you're trying to do.


What exactly do you mean by VBA Form? Are you trying to import a Form from a different Access Database, or are you talking about UserForms, which are used in Word, Excel, etc.?.

Yes, by "VBA Form" I meant "VBA UserForm", which is totally different from an "Access Form", which is really a GUI for a RecordSet. I have tons of experience with VBA UserForms, and I have a big library that I would like to import and use.


Are you certain that you have the correct references needed to support all of the objects and methods used?

Yes. Everything compiles just fine, it just doesn't save properly for some reason. I also was having a hard time splitting a UserForm in two, becuase even if you change the UserForm Name, you can't import the form under the old name.




If you're in Access you should just be able to, on the Database window, click Forms -> New to create a new, blank form.

No, this adds an Access Form. There doesn't seem to be any way to add a real VBA UserForm to an Access project.

CreganTur
07-18-2008, 05:07 AM
There doesn't seem to be any way to add a real VBA UserForm to an Access project.

That's what I was going to say- I don't think that UserForms can be used in Access because Access has Forms.

This would be more time consuming, but you could always recreate your UserForms in Access using Access Forms- just make sure all of your objects have the same name; then you should be able to just c&p your code over from behind the UserForm and have it work (except for syntax differences that would have to be corrected).