I have a problem trying to link my access table using VB
I can connect using the below connection string ...
Driver={SQL
Server};SERVER=MYSERVER;UID=MYUSERNAME;PWD=myPASSWORD;DATABASE=myDATABASE;
WHEN I USE...
Set dbsODBC = OpenDatabase("",False, False, strConnect)
BUT IF I try to disable the prompt using...
Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False, strConnect)
AND
Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False,"ODBC;" &
strConnect)
my connection either does not connect or it displays the prompt. I
think the problem has something to do with me not using a DSN, but I
thought I should be able to connect without one. PLEASE HELP!
What am I doing wrong, and why would this be happening?
THANK YOU!!I don't understand your question. Open Database is a method of the Jet
database engine (DAO) used with Microsoft Access, not SQL Server. The
connection string you are using is not the correct syntax for the DAO
OpenDatabase method. If you're trying to open an Access database that has a
table in it that is linked to SQL Server, then the linked table has to have
the DSN-less connection string in it's Connect property and you need to use
the syntax for DAO as the parameter to the OpenDatabase function. But, I'm
having a hard time figuring out why you would want to do this? To connect to
a SQL Server DB from VB you should be using ADO (ActiveX Data Objects). The
connection string you are using *is* the correct syntax for the ADO
Connection object's Open method. No need for Jet or Access at this point.
<stoppal@.hotmail.com> wrote in message
news:1129838783.819043.87440@.o13g2000cwo.googlegroups.com...
> I have a problem trying to link my access table using VB
>
> I can connect using the below connection string ...
>
> Driver={SQL
> Server};SERVER=MYSERVER;UID=MYUSERNAME;PWD=myPASSWORD;DATABASE=myDATABASE;
>
> WHEN I USE...
>
> Set dbsODBC = OpenDatabase("",False, False, strConnect)
>
> BUT IF I try to disable the prompt using...
>
> Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False, strConnect)
> AND
> Set dbsODBC = OpenDatabase("", dbDriverNoPrompt, False,"ODBC;" &
> strConnect)
>
> my connection either does not connect or it displays the prompt. I
> think the problem has something to do with me not using a DSN, but I
> thought I should be able to connect without one. PLEASE HELP!
>
> What am I doing wrong, and why would this be happening?
>
> THANK YOU!!
>|||thank you for the recommendation I'll try it at work tommorrow.
I'll tell you if it works friday, morning|||GOT IT WORKS, THANK YOU!!!!!!!!!!!!!!!!
Showing posts with label driversql. Show all posts
Showing posts with label driversql. Show all posts
Wednesday, March 21, 2012
Friday, March 9, 2012
Divide by zero error?
I have several situations where I encounter the following error:
[Microsoft][ODBC SQL SERVER DRIVER][SQL Server]Divide by zero error
encountered.
I'm sure this topic has been covered hundreds of times - but how would I
stop this error in the following query:
SELECT [Pharmacy Exp] / TotalMem AS PhExpPMPM
FROM Sheet1$
WHERE ([Pharmacy Exp] <> '') AND (Period = '3Q04') AND (Domicile LIKE
'%ct%' OR
Domicile LIKE '%ma%' OR
Domicile LIKE '%nh%' OR
Domicile LIKE '%me%' OR
Domicile LIKE '%ri%' OR
Domicile LIKE '%vt%' OR
Domicile LIKE '%ny%' OR
Domicile LIKE '%nj%')
This issues comes about because either [pharmacy exp] or TotalMem is either
null or zero. I don't want to exclude the data from my query (ie: using
where [pharmacy exp] <>'') but would rather show a zero for the data point.SELECT CASE (TotalMem WHEN 0 THEN 0
ELSE [Pharmacy Exp] / TotalMem END PhExpPMPM
FROM Sheet1$
WHERE ([Pharmacy Exp] <> '') AND (Period = '3Q04') AND (Domicile LIKE
'%ct%' OR
Domicile LIKE '%ma%' OR
Domicile LIKE '%nh%' OR
Domicile LIKE '%me%' OR
Domicile LIKE '%ri%' OR
Domicile LIKE '%vt%' OR
Domicile LIKE '%ny%' OR
Domicile LIKE '%nj%')
Jacco Schalkwijk
SQL Server MVP
"William" <da@.northernit.net> wrote in message
news:KlU3e.6431$6a5.1685@.twister.nyroc.rr.com...
>I have several situations where I encounter the following error:
> [Microsoft][ODBC SQL SERVER DRIVER][SQL Server]Divide by zero error
> encountered.
> I'm sure this topic has been covered hundreds of times - but how would I
> stop this error in the following query:
>
> SELECT [Pharmacy Exp] / TotalMem AS PhExpPMPM
> FROM Sheet1$
> WHERE ([Pharmacy Exp] <> '') AND (Period = '3Q04') AND (Domicile LIKE
> '%ct%' OR
> Domicile LIKE '%ma%' OR
> Domicile LIKE '%nh%' OR
> Domicile LIKE '%me%' OR
> Domicile LIKE '%ri%' OR
> Domicile LIKE '%vt%' OR
> Domicile LIKE '%ny%' OR
> Domicile LIKE '%nj%')
> This issues comes about because either [pharmacy exp] or TotalMem is
> either
> null or zero. I don't want to exclude the data from my query (ie: using
> where [pharmacy exp] <>'') but would rather show a zero for the data
> point.
>
[Microsoft][ODBC SQL SERVER DRIVER][SQL Server]Divide by zero error
encountered.
I'm sure this topic has been covered hundreds of times - but how would I
stop this error in the following query:
SELECT [Pharmacy Exp] / TotalMem AS PhExpPMPM
FROM Sheet1$
WHERE ([Pharmacy Exp] <> '') AND (Period = '3Q04') AND (Domicile LIKE
'%ct%' OR
Domicile LIKE '%ma%' OR
Domicile LIKE '%nh%' OR
Domicile LIKE '%me%' OR
Domicile LIKE '%ri%' OR
Domicile LIKE '%vt%' OR
Domicile LIKE '%ny%' OR
Domicile LIKE '%nj%')
This issues comes about because either [pharmacy exp] or TotalMem is either
null or zero. I don't want to exclude the data from my query (ie: using
where [pharmacy exp] <>'') but would rather show a zero for the data point.SELECT CASE (TotalMem WHEN 0 THEN 0
ELSE [Pharmacy Exp] / TotalMem END PhExpPMPM
FROM Sheet1$
WHERE ([Pharmacy Exp] <> '') AND (Period = '3Q04') AND (Domicile LIKE
'%ct%' OR
Domicile LIKE '%ma%' OR
Domicile LIKE '%nh%' OR
Domicile LIKE '%me%' OR
Domicile LIKE '%ri%' OR
Domicile LIKE '%vt%' OR
Domicile LIKE '%ny%' OR
Domicile LIKE '%nj%')
Jacco Schalkwijk
SQL Server MVP
"William" <da@.northernit.net> wrote in message
news:KlU3e.6431$6a5.1685@.twister.nyroc.rr.com...
>I have several situations where I encounter the following error:
> [Microsoft][ODBC SQL SERVER DRIVER][SQL Server]Divide by zero error
> encountered.
> I'm sure this topic has been covered hundreds of times - but how would I
> stop this error in the following query:
>
> SELECT [Pharmacy Exp] / TotalMem AS PhExpPMPM
> FROM Sheet1$
> WHERE ([Pharmacy Exp] <> '') AND (Period = '3Q04') AND (Domicile LIKE
> '%ct%' OR
> Domicile LIKE '%ma%' OR
> Domicile LIKE '%nh%' OR
> Domicile LIKE '%me%' OR
> Domicile LIKE '%ri%' OR
> Domicile LIKE '%vt%' OR
> Domicile LIKE '%ny%' OR
> Domicile LIKE '%nj%')
> This issues comes about because either [pharmacy exp] or TotalMem is
> either
> null or zero. I don't want to exclude the data from my query (ie: using
> where [pharmacy exp] <>'') but would rather show a zero for the data
> point.
>
Labels:
database,
divide,
driversql,
encounter,
error,
errormicrosoftodbc,
following,
microsoft,
mysql,
oracle,
server,
serverdivide,
situations,
sql,
zero
Subscribe to:
Posts (Atom)