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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing Multiple tables in VB6 1

Status
Not open for further replies.

mans

Programmer
Mar 18, 2000
136
AU
Good DAy,<br><br>I am attempting to execute a query within VB6, which is using the MS Access 2000 database, without any luck.&nbsp;&nbsp;I am looking to multiply two values, each of which is in a different table (each table has just the one record, one field, and each are of the same numerical data type).&nbsp;&nbsp;The query runs within Access 2000 without a problem but VB6 cannot run it (without an error message).&nbsp;&nbsp;I am having a problem with multiple tables in action queries within VB6, I cannot attach the two tables by a common field (primary and foreign key).&nbsp;&nbsp;Other action queries within the same sub-routine below, which access one table only, run fine within VB6.&nbsp;&nbsp;The query as it is in VB6 is attached below:<br><br>sPath = &quot;c:\Program Files\management\competition\competition.mdb&quot;<br>Set daoDB36 = DBEngine(0).OpenDatabase(sPath)<br><br>daoDB36.Execute &quot;INSERT INTO MembRet3 (Duplicates) SELECT(MembRet2.Duplicates/MembDup1.MembDup) As ttt From MembRet2, MembDup1&quot;<br><br>I would appreciate it if someone could let me know what I can do to run the query above.<br><br>Regards<br><br>
 
What error is VB throwing?<br>Also, if Access doesn't have a problem with the statement, could you define a QueryDef in the database and execute it, instead of passing the SQL statement?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top