Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Logon Dialog prior to Open Database connection

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Logon Dialog prior to Open Database connection

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

Mark


Mike wrote:
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Logon Dialog prior to Open Database connection

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

"Mark Driscol" wrote:

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

Mark


Mike wrote:
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Logon Dialog prior to Open Database connection

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


Mike wrote:
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

"Mark Driscol" wrote:

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

Mark


Mike wrote:
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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Logon Dialog prior to Open Database connection

Thanks, I will have a look at that.

"Mark Driscol" wrote:

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


Mike wrote:
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

"Mark Driscol" wrote:

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

Mark


Mike wrote:
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Connection Phil Excel Programming 1 September 30th 05 12:25 PM
Database Connection Jake Marx[_3_] Excel Programming 0 July 1st 05 03:50 PM
Database Connection from Excel Lost! Excel Programming 1 August 31st 04 02:19 AM
dialog box displayed when internet connection unavailable nil Excel Programming 2 January 28th 04 10:04 PM
DataBase Connection willie[_2_] Excel Programming 0 January 27th 04 10:06 PM


All times are GMT +1. The time now is 07:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"