...

View Full Version : Tables



Xiang
03-19-2004, 05:24 PM
Dear Sir,


Referes to VB 6.0
I have create a database file called "ar.mdb" and in the "ar.mdb" i have create several table called "code", "CCategory" and etc.
How can I access various tables in a database file to a form.
Below coding will occur run time error. Do you know the coding.

Private Sub Form_Load()
SQL = "SELECT * FROM CCategory ORDER BY CusCat"
SQL = SQL & "SELECT * FROM SCategory ORDER BY SalesCat"
SQL = SQL & "SELECT * FROM Code ORDER BY CardCode"
Set RS = gDB.OpenRecordset(SQL)


Thanks,

Xaing

Roy Sinclair
03-19-2004, 05:59 PM
It errors because by the time you read the OpenRecordset call the text of your SQL looks like this:

SELECT * FROM CCategory ORDER BY CusCatSELECT * FROM SCategory ORDER BY SalesCatSELECT * FROM Code ORDER BY CardCode

You need to terminate each select with a semicolon (;) and then you should get a recordset object containing three recordsets.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum