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

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

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.