Hi
I am trying to retrieve a record depending on a value in a specific column in a DataGrid. for this I am using following code for in the DataGrid's SelChange event.
Private Sub DataGrid1_SelChange(Cancel As Integer)
Dim sApptID As Integer
Dim sApptTypeID As Integer
Dim cmdAdodc3txt As String
Dim sSearchText As String
'Storing the two parameters from datagrid for the following SQL query
DataGrid1.Col = 3
sApptID = DataGrid1.Text
DataGrid1.Col = 4
sApptTypeID = DataGrid1.Text
Adodc3.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\hair\hair.mdb"
cmdAdodc3txt = "Select Appointment_Date, Appointment_TotalCost, " & _
"Appointment_Time, AppointmentType_Desc," & _
" Stylist_LastName, Stylist_FirstName, " & _
"PaymentType_Desc from tblAppointmentItem," & _
" tblAppointmentType, tblAppointment, tblStylist, tblPaymentType where " & _
"Appointment_Id = " & sApptID & "" & _
" and AppointmentItem_AppointmentTypeId =" & sApptTypeID & "" & _
" and AppointmentItem_AppointmentTypeId =" & _
" AppointmentType_Id and " & _
"Appointment_Id = AppointmentItem_AppointmentId" & _
" and Appointment_StylistId = Stylist_Id" & _
" and Appointment_PaymentTypeId = PaymentType_Id"
Adodc3.RecordSource = cmdAdodc3txt
Adodc3.Refresh
For i = 0 To 5
With Adodc3.Recordset
txtAppt(i) = .Fields(i)
End With
Next
End Sub
This works when I click for the first time on any row in the datagrid, but when I click for the second time on a different row it gives the following error msg:
"Insufficient key column information for updating or refreshing"
and the selection row remains the same.
Can anybody please tell me what's wrong?
Thanks in advance,
balajee
I am trying to retrieve a record depending on a value in a specific column in a DataGrid. for this I am using following code for in the DataGrid's SelChange event.
Private Sub DataGrid1_SelChange(Cancel As Integer)
Dim sApptID As Integer
Dim sApptTypeID As Integer
Dim cmdAdodc3txt As String
Dim sSearchText As String
'Storing the two parameters from datagrid for the following SQL query
DataGrid1.Col = 3
sApptID = DataGrid1.Text
DataGrid1.Col = 4
sApptTypeID = DataGrid1.Text
Adodc3.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\hair\hair.mdb"
cmdAdodc3txt = "Select Appointment_Date, Appointment_TotalCost, " & _
"Appointment_Time, AppointmentType_Desc," & _
" Stylist_LastName, Stylist_FirstName, " & _
"PaymentType_Desc from tblAppointmentItem," & _
" tblAppointmentType, tblAppointment, tblStylist, tblPaymentType where " & _
"Appointment_Id = " & sApptID & "" & _
" and AppointmentItem_AppointmentTypeId =" & sApptTypeID & "" & _
" and AppointmentItem_AppointmentTypeId =" & _
" AppointmentType_Id and " & _
"Appointment_Id = AppointmentItem_AppointmentId" & _
" and Appointment_StylistId = Stylist_Id" & _
" and Appointment_PaymentTypeId = PaymentType_Id"
Adodc3.RecordSource = cmdAdodc3txt
Adodc3.Refresh
For i = 0 To 5
With Adodc3.Recordset
txtAppt(i) = .Fields(i)
End With
Next
End Sub
This works when I click for the first time on any row in the datagrid, but when I click for the second time on a different row it gives the following error msg:
"Insufficient key column information for updating or refreshing"
and the selection row remains the same.
Can anybody please tell me what's wrong?
Thanks in advance,
balajee