A few days ago
sant t

I am doing a prog in VB6…..the following code is problematic….please help……?

1. im using an ODBC (Data connector)……to connect my DB(MS access 2000) with VB6.0

2. im having a string variable “tab” to assign a table name value(im having many tables..and by using an if loop im assigning any of the tables to this variable tab”)

3. now this code shows error to open a recordset….

(i.e. i want to connect all the fields(*) from that string variable-“tab” which contains the table name”

the code is :

Set rs = db.OpenRecordset(“select * from “& tab&” “)….

This is the way i hope. but it dosen’t works….says that there is some syntax error…….

Please help Me…i’ll be very much greatfull to You………….

Thank You…………

Top 1 Answers
A few days ago
OmniscientOne

Favorite Answer

did you try assigning the query to a var before calling openrecordset?

sql = “select * from ” & tab & ” where…”

set rs=db.openrecordset(sql)…

0