Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-19-2004, 04:24 PM   PM User | #1
Xiang
New Coder

 
Join Date: Jul 2002
Location: Malaysia
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Xiang is an unknown quantity at this point
Tables

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
Xiang is offline   Reply With Quote
Old 03-19-2004, 04:59 PM   PM User | #2
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
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.
__________________
Check out the Forum Search. It's the short path to getting great results from this forum.
Roy Sinclair is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:01 PM.


Advertisement
Log in to turn off these ads.