473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

SQL data connection not in all forms

samycbe
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
5 1136
sashi
1,754 Expert 1GB
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
579 512MB
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
83
I did that but shows an error like.....

okject variable or with block variable not set
Apr 3 '07 #4
samycbe
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
579 512MB
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

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

Similar topics

2
by: Josh Strickland | last post by:
I am attempting to create an Access database which uses forms to enter data. The issue I am having is returning the query results from the Stored Procedure back in to the Access Form. ...
7
by: Dica | last post by:
i've used the sample code from msdn to create an encyption/decryption assembly as found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT10.asp i'm...
6
by: Jon Davis | last post by:
I like the drag-and-drop accessibility of dragging a table to a Web Forms designer and seeing a SqlDataAdapter automatically created for me.. being able to create a DataSet from that is fun and...
5
by: DC Gringo | last post by:
I am having a problem reading a simple update to the database. Basically I'm testing a small change to the pubs database -- changing the price of the Busy Executive's Database Guide from 19.99 to...
5
by: rogsonl | last post by:
My computer was moved last week, and the company changed the network groups we work on. As a result, one of the main benefits from Whidbey (database connectivity) no longer works. Situation: 1....
9
by: Brad | last post by:
I have written some code to manipulate data/records in a MASTER (order header) and DETAIL (order details) tables. What I have written is too extensive to post but essentially trying to: 1....
26
by: Rajeev Tipnis | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en- us;819450 Questions: 1) Is this patch (fix) applicable to the .NET 1.1 Framework as well? That is, if we have Framework 1.1 (On...
4
by: Josema | last post by:
Hi to all, Im searching a hand to solve an Exception that i get when i try to give the user to a gmail account... Any help would be appreciated.. Thanks in advance This is a piece of my...
6
by: Wesley Peace | last post by:
I hate to cross post, but I've gotten no answer yet on a problem I'm having with visual studio 2008. I've created a series of forms with controls to access a Access database tables. The...
12
lifeisgreat20009
by: lifeisgreat20009 | last post by:
I am a newbie to Struts and JSP...I have been working on the code below for 5 hours now..I googled a lot but couldn't get much help so finally I am here.. Hoping of getting my problem solved. Please...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.