|
-
Jan 28th, 2000, 09:29 AM
#1
Thread Starter
Junior Member
I can't remember if I posted here about how to get a DBGrid to show related fields in another table.
For example ... all records in the Orders Table have a Status field that can be 1,2,3 etc and they link to a Status Description Table, that has the 1,2,3 etc linking up to short 15 character descriptions.
Now I can do it in Crystal Reports, but I would like to be able to show it on a DBGrid before printing it ... I think clunietp suggested an SQL join statement ... can you or anyone give me some demo code to work from ?
As always I appreciate the time.
Cheers Dave
-
Jan 28th, 2000, 12:19 PM
#2
New Member
Dim openSQL As String
Dim mdb As DAO.Recordset
Dim rst As DAO.Recordset
'the sql statment joining the 2 or more tables
openSQL = " SELECT ... "
Set rst = mdb.OpenRecordset(openSQL)
Set DBGrid1.Recordset = rst
DBGrid1.Refresh
-
Jan 29th, 2000, 10:00 AM
#3
Thread Starter
Junior Member
Hi,
Thanks for your reply, although I guess I should have specified that I was using VB 5 and Access 97.
Couldn't find the DBGrid1.Recordset property.
Any other suggestions out there ?
Cheers Dave
-
Jan 30th, 2000, 12:15 PM
#4
Hyperactive Member
Hi, DBGrid control doesn't have Recordset property. Usually DBGrid is connected to datacontrol and then you use datacontrol properties:
Dim sqlStr As String
sqlStr = "select * from categories where categoryID=1 or categoryID=2 "
Data1.RecordSource = sqlStr
Data1.Refresh
Larisa
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|