473,325 Members | 2,671 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,325 software developers and data experts.

Passthrough Query and manipulating .Connect property *Help!!*

Hi
I use Access2002
I have created a simple form with 3 parameter UserID, Password &
Database
When a user enters values into these text boxes a passthrough query to
a Sybase database is envoked with the connection string set to the
form parameters
My problem is that when an invalid username, password or database
string is entered the passthrough query still works even though
looking at the connect property this has changed to the form input

Any ideas?? - this is driving me mad!! Here is the function I wrote:

Call create_qry("qpt_IRRollIRCurve", "exec IRRollIRCurve", strCon)

Function create_qry(strQryName As String, strSQL As String, Optional
strCon As String)

Dim db As DAO.Database
Dim qdf As DAO.QueryDef

Set db = CurrentDb
Set qdf = db.CreateQueryDef(strQryName)

If IsNull(strCon) = False Then
With qdf
.Connect = strCon
.SQL = strSQL
End With
Else
End If

Set qdf = Nothing
Set db = Nothing

Regards Kay

Jul 26 '07 #1
1 2254
Check this:

With qdf
.Connect = strCon
.SQL = strSQL
.Execute 'You're missing the execute part.
End With

Besides that, make sure the optional parameter is null when you think
it is:

msgbox "strCon value: [" & strCon & "] - NULL: " & iif
(isnull(strCon),"YES","NO")

Regards

On Jul 26, 8:26 am, KayC <kay_c...@yahoo.co.ukwrote:
Hi
I use Access2002
I have created a simple form with 3 parameter UserID, Password &
Database
When a user enters values into these text boxes a passthrough query to
a Sybase database is envoked with the connection string set to the
form parameters
My problem is that when an invalid username, password or database
string is entered the passthrough query still works even though
looking at the connect property this has changed to the form input

Any ideas?? - this is driving me mad!! Here is the function I wrote:

Call create_qry("qpt_IRRollIRCurve", "exec IRRollIRCurve", strCon)

Function create_qry(strQryName As String, strSQL As String, Optional
strCon As String)

Dim db As DAO.Database
Dim qdf As DAO.QueryDef

Set db = CurrentDb
Set qdf = db.CreateQueryDef(strQryName)

If IsNull(strCon) = False Then
With qdf
.Connect = strCon
.SQL = strSQL
End With
Else
End If

Set qdf = Nothing
Set db = Nothing

Regards Kay

Jul 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bernard Drolet | last post by:
Hi, I have a table containing many millions of rows. This table has a tree stucture, with the following columns id name parent_id I need to go through the tree, starting from a specific Id,...
0
by: B. Fongo | last post by:
------=_NextPart_000_0011_01C36322.2FEF5DC0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable It works!=20 SELECT Customers.Name, Customers.City,...
1
by: David Ehrenreich | last post by:
Hello, I have my Database setup with a backend and several instances of the same form in a frontend linked to the backend tables. Their are several of these frontend stations. What I like to...
1
by: PeteCresswell | last post by:
I'm doing this: --------------------------------------------------------- 5200 Case "Query" On Error Resume Next Set curQD = thisDB.QueryDefs(!ObjectName) curErr = Err On Error GoTo...
3
by: colin.anderson | last post by:
Hi I am trying to refresh table links at startup in an Access 2002 application. The following code is based on a number of articles posted in this group but this does not seem to work: ...
0
by: Hash123 | last post by:
Hi All, Does anyone know what is the equivalent query for 1 SELECT name, salary 2 FROM emp 3 START WITH name = 'Goyal' 4 CONNECT BY PRIOR empid = mgrid in DB2
1
by: newtechiebug | last post by:
I am trying to convert a MS Access Query to a SQL query and I need help with some IIF Statements? 2 in particular that I've encountered problems with are: Count(IIf(=0 Or...
2
by: RoadrunnerII | last post by:
Hi All I am new to this forum and still learning MS Access. Hoping this is the right place to ask If not please let me know! Looking for some help with the SQL statements in Access 2003 with the...
3
by: ryanjkoffler | last post by:
Hello... I have a single passthrough query where the possiblity for it to return zero records exists. If zero records will be returned, is there a way to add some logic that will catch this and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.