By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,098 Members | 1,405 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,098 IT Pros & Developers. It's quick & easy.

SQL data connection not in all forms

samycbe
P: 83
Hi

I have a sql server connection in my user login form_load...

Con.CursorLocation = adUseClient
Con.Open "Provider = SQLOLEDB.1;Persist Security Info=false;user ID=xxxx;pwd=yyy;Initial catalog = ;Data Source = xxxx"

it is working only in that form but it is not working in other forms. how to make it global. please help me ......

samy
Apr 3 '07 #1
Share this Question
Share on Google+
5 Replies


sashi
Expert 100+
P: 1,754
Hi there,

Add a module file file to your existing project and place the code segment under a function, as a shortcut you can call the function whenever you need to get connected to SQL server. Hope it helps. Good luck & Take care.

Hi

I have a sql server connection in my user login form_load...

Con.CursorLocation = adUseClient
Con.Open "Provider = SQLOLEDB.1;Persist Security Info=false;user ID=xxxx;pwd=yyy;Initial catalog = ;Data Source = xxxx"

it is working only in that form but it is not working in other forms. how to make it global. please help me ......

samy
Apr 3 '07 #2

vijaydiwakar
100+
P: 579
Hi

I have a sql server connection in my user login form_load...

Con.CursorLocation = adUseClient
Con.Open "Provider = SQLOLEDB.1;Persist Security Info=false;user ID=xxxx;pwd=yyy;Initial catalog = ;Data Source = xxxx"

it is working only in that form but it is not working in other forms. how to make it global. please help me ......

samy
put the code in module with public access specifier
Apr 3 '07 #3

samycbe
P: 83
I did that but shows an error like.....

okject variable or with block variable not set
Apr 3 '07 #4

samycbe
P: 83
hi sashi....

Its working now. Thanks.

But i have one small doubt i am calling a function in all form_loads. Is it required?


samy
Apr 3 '07 #5

vijaydiwakar
100+
P: 579
I did that but shows an error like.....

okject variable or with block variable not set
first defind the conn object there as public in module
Apr 3 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.