Darren Smith
Well-known Member
- Joined
- Nov 23, 2020
- Messages
- 631
- Office Version
- 2019
- Platform
- Windows
Try to find a value in the column in excel (In this case, "Rear Door - NS - See Drawing") then use it in the access database query??
The error says "Command text was not set for the command object"
The error says "Command text was not set for the command object"
VBA Code:
Private Sub SetIDLengthofRearDoorPoleHandelPostion()
Dim iRow As Integer
Dim qry As String
Dim rs As Object: Set rs = OpenConAndGetRS(qry)
With ThisWorkbook.Worksheets("Job Card Master")
Select Case Me.Body_Type.Value
Case ("Tippa with STD Cage")
qry = "SELECT * FROM [IDAndData] " & _
" WHERE [Vehicle]='" & Model_Type.Text & "'" & _
" AND [FramesWidth&Height]='" & Gantry_Height_Width.Text & "'" & _
" AND [Material/Part]='" & .Range("E1:F" & .UsedRange.Rows.Count).Find("Rear Door - NS - See Drawing", LookIn:=xlValues, lookat:=xlWhole).Value
End Select
iRow = .Range("E1:F" & .UsedRange.Rows.Count).Find("TC - TL - THTT", LookIn:=xlValues, lookat:=xlWhole).Row
If Not (rs.BOF Or rs.EOF) Then
Do While Not rs.EOF
.Cells(iRow, 5) = rs.Fields("LengthofRearDoorPole&HandelPostion").Value
iRow = iRow + 1
rs.MoveNext
Loop
End If
rs.Close: Set rs = Nothing
End With
End Sub