|
-
Feb 20th, 2003, 12:26 PM
#1
Thread Starter
Lively Member
ADO Connection Objects
I am using this code to try to populate a datagrid...All the code related to "History".
The datagrid is not populating at all.
Someone please help me!!!!
[General] [Declarations]
Dim cnDetails As Connection
Dim comDetails As Command
Dim rsDetails As Recordset
Dim comHistory As Command
Dim rsHistory As Recordset
Private Sub cmdHistory_Click()
Dim clientid As Integer
clientid = txtC_No
comHistory.CommandText = "SELECT History.Transaction_Date, tblStyle.Style, History.Formula, History.Colour_Desc, tblStaff.S_F_Name, tblClient.C_Number FROM tblStyle INNER JOIN (tblStaff INNER JOIN (tblClient INNER JOIN History ON tblClient.C_Number = History.C_Number) ON tblStaff.S_Number = History.S_Number) ON tblStyle.Style_Number = History.Style_Number Where tblClient.C_Number = " & clientid & " Order By History.Transaction_Date Desc "
rsHistory.Requery
Set rsHistory = comHistory.Execute
End Sub
Private Sub Form_Load()
Set cnDetails = New Connection
Set comDetails = New Command
Set rsDetails = New Recordset
cnDetails.Provider = "Microsoft.Jet.OLEDB.4.0"
cnDetails.ConnectionString = "A:VBPRO_Compacted.mdb"
cnDetails.Open
comDetails.ActiveConnection = cnDetails
comDetails.CommandText = "SELECT tblClient.C_Number, tblClient.C_F_Name, tblClient.C_L_Name, tblClient.C_Street, tblClient.C_Town, tblClient.C_County, tblClient.C_Phone, tblClient.C_Age, tblClient.C_Preferences, tblClient.C_Gender, tblClient.Notes, tblStaff.S_F_Name FROM tblStaff INNER JOIN tblClient ON (tblStaff.S_Number = tblClient.C_Prefered_Stylist) "
Set rsDetails = comDetails.Execute
Set comHistory = New Command
Set rsHistory = New Recordset
comHistory.ActiveConnection = cnDetails
comHistory.CommandText = "SELECT History.Transaction_Date, tblStyle.Style, History.Formula, History.Colour_Desc, tblStaff.S_F_Name, tblClient.C_Number FROM tblStyle INNER JOIN (tblStaff INNER JOIN (tblClient INNER JOIN History ON tblClient.C_Number = History.C_Number) ON tblStaff.S_Number = History.S_Number) ON tblStyle.Style_Number = History.Style_Number "
Set rsHistory = comHistory.Execute
BindData
End Sub
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
|