access problem

aks6190

Registered User.
Local time
Today, 13:01
Joined
Feb 23, 2011
Messages
10
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim bid As Integer

Private Sub cboBoid_Change()
bid = (cboBoid.Text)
Dim res As New ADODB.Recordset
res.Open "select * from Customer_order where Bookorder_id=' " & bid & " ' ", con, adOpenKeyset, adLockOptimistic
res.Open "Select * from Customer_book_order_details Bookorder_id=' " & bid & " ' ", con, adOpenKeyset, adLockOptimistic
res.MoveFirst

While (res.EOF <> True)
If (res(0) = bid) Then
txtCustname.Text = (res("Cust_name"))
txtAdvance.Text = (res("Advance_pay"))
txtBname.Text = (res("Bookname"))
txtAuthor.Text = (res("Author"))
txtQuantity.Text = (res("Quantity"))
res.MoveNext
End If
Wend

res.Close
End Sub


Private Sub Form_Load()
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Set con = New ADODB.Connection
Set rs = New ADODB.Recordset
con.Provider = "Microsoft.Jet.OLEDB.4.0"
con.Open App.Path & "\Bookshop.mdb"

rs.ActiveConnection = con
rs.CursorLocation = adUseClient
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic
rs.Open "SELECT * FROM Customer_order"

With rs1
.ActiveConnection = con
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open "SELECT * FROM Customer_order_payment"
End With

With rs2
.ActiveConnection = con
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open "SELECT * FROM Customer_book_order_details"

End With
End Sub


i am trying to retrieve data from three different tables which are mentioned in form load event........when i will select id from cboBoid.text the info from three different tables should be displayed in respective textboxes.....but i am not able to do that.I am not getting any error but data is not getting displayed......plz help.....i am using vb 6.0 and ms access 2007.....thanks!......
 
Have you thought about basing your form on a query contining the data you want. Also it makes your code sample easier to read if you enclose it in code tags like this

[ code ]

[ /code ] only without the spaces
 
thank u sir!.......
 

Users who are viewing this thread

Back
Top Bottom