PDA

View Full Version : Excel form to database help



hypuk
10-07-2009, 09:56 AM
Hi
hope you're ok.

I've created a userform in Excel and wanted to know how I can get the information entered into the userform into a database?

Here's the scenario.

I want the userform to collect data I.E Hotel booking request

Then once the user has entered all of the information into the form, they click a button, form is closed and a unique reference number is generated in a dialogue box.

Then the booking team can access a booking queue where all the submitted booking requests are,

We have already have this kind of thing in place and Visual Basic and SQL are used.

If you can point me in the right direction that would be fantastic.

I'm new to VBA and SQL however I pick things up quite quickly

Any help would be much appreciated.

Thanks
Mark

JP2112
10-08-2009, 08:01 AM
After clicking the button, you can read the form fields using the syntax Me.ControlName.Value. For example, if you have a textbox called "ZipCode", you read the value using Me.ZipCode.Value.

There are several ways you can collect the information from the form and write to a db.

You can use class modules to create objects that hold the values from your form. For a hotel booking, you would need at least 2 class modules: one to represent the customer, the other for the request (i.e. hotel room).

You should mention what sort of db you have (Access?), someone might be able to provide sample code for that.

slamet Harto
10-08-2009, 08:03 AM
it seems to long discussions. have you tried to explore some sample code program from this wonderful forum.

if you had a problem with the code, then you could share with us. I believe, expertise here will glad to help you

Best, harto