|
-
Aug 2nd, 2004, 03:47 AM
#1
Thread Starter
Addicted Member
how do i show DB Access datasheet in vb program
hi, experts, how do i shoe the db Access datasheet in the vb program.....
my previous code is this:
Dim db As Database
Dim ws As Workspace
Dim Rst As DAO.Recordset
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(MyConn)
Set Rst = db.OpenRecordset("SELECT * FROM " & month.Text & " ORDER BY (invoiceno)", dbOpenDynaset, dbReadOnly)
Do While Not Rst.EOF
cmbDr.AddItem Rst.Fields("invoiceno")
Rst.MoveNext
Loop
----------------------------------------------
but i doesnt work.....
do anyone have a better idea of showing the DB Access datasheet......
Ah Xing
<< Ah XinG AlWaYs HeRe To RoCK U Up >>
-
Aug 2nd, 2004, 09:17 AM
#2
You keep saying "showing the DB Access datasheet" but you're only attempting to load one field ("invoiceno") into some combobox ...
So, what is it that you need to get from db and display on the form ???
Be more specific, please.
-
Aug 2nd, 2004, 09:42 AM
#3
Addicted Member
Dim db As Database
Dim ws As Workspace
Dim Rst As DAO.Recordset
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(MyConn)
Set Rst = db.OpenRecordset("SELECT * FROM " & month.Text & " ORDER BY (invoiceno)", dbOpenDynaset, dbReadOnly)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'add a datagrid to your projet
Set DataGrid1.DataSource = Rst
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''Do While Not Rst.EOF
'''''''''''''cmbDr.AddItem Rst.Fields("invoiceno")
''''''''''''''''Rst.MoveNext
''''''''''''''''Loop
-
Aug 2nd, 2004, 08:25 PM
#4
Thread Starter
Addicted Member
actually this is a code i get from someone and it is not working so i'm asking if anyone knows how to load the whole datasheet into the vb prgrams anot....so do you know RhinoBull...??
Ah Xing
<< Ah XinG AlWaYs HeRe To RoCK U Up >>
-
Aug 3rd, 2004, 04:20 PM
#5
Sorry for late respond ...
You may use Datagrid control and use technic that is already posted by johnpc.
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
|