Logon Dialog prior to Open Database connection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm using this code to open a database connection using ADODB inside VBA.
What I would like to have is a dialog so that users must enter their
username, password and DSN name. I don't like to have this information
written in the code. I know that I can protect the code but still since there
are several users using the same sheet. It will be easier for me to maintain
it.


Thanks

Public db as new ADODB.Connection

sub test()

db.open "DSN name", "Username", "Password"

......

end sub
 
You can set up a UserForm with Textboxes on it to capture the
information, and then use the user entries in your code.

Mark
 
Yes, OK I know that I can use a Sheet and on that draw a Form with textboxes.
What I would like to have instead is a popupdialog where they enter user
information.

Do you know if it's possible?

//Mike
 
Mike, a UserForm does "pop up". You put your Textbox controls on the
UserForm, not a Worksheet.

If you want more information on UserForms, you could see, for example,
one of John Walkenbach's Power Programming books for Excel.

Mark
 
Thanks, I will have a look at that.

Mark Driscol said:
Mike, a UserForm does "pop up". You put your Textbox controls on the
UserForm, not a Worksheet.

If you want more information on UserForms, you could see, for example,
one of John Walkenbach's Power Programming books for Excel.

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top