Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connect to SQL in ADP

Status
Not open for further replies.

SQLScholar

Programmer
Aug 21, 2002
2,127
GB
Hey all

I am trying to hide a text box - based on a query that runs on the database (its an ADP so database is SQL).

I have the below:

Code:
 Dim rs As DAO.Recordset
 Dim db As DAO.Database
 Dim strSQL As String

 Set db = CurrentDb()

 strSQL = "SELECT col1, col2, col3 FROM tablename WHERE fields = '" & database.form.txtbox & "'"

 Set rs = db.OpenRecordset(strSQL)

However I get an error on that last line saying "Object variable or With Block variable not set.

Any ideas? I am guessing it could be that i am not really connecting to access - but to SQL.

Dan

----------------------------------------

Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind - Bernard Baruch

Computer Science is no more about computers than astronomy is about telescopes - EW Dijkstra
----------------------------------------
 
No - it doesnt work with a constant. And it gets past that line. No i dont have those fieldnames - just removed to protect the innocent.

Thanks

dan

----------------------------------------

Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind - Bernard Baruch

Computer Science is no more about computers than astronomy is about telescopes - EW Dijkstra
----------------------------------------
 
Personally - i think that could also be the issue.

I have managed to find a way around it in a rather convoluted way but it works!

Thanks anyway.

----------------------------------------

Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind - Bernard Baruch

Computer Science is no more about computers than astronomy is about telescopes - EW Dijkstra
----------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top