473,287 Members | 1,426 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,287 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 2253
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
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...
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)...

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.