Hello,
I am adding one procedure populating a Datagrid into existing project; hereis the new, added code giving me an error message as above.
Debug.print of the sSQL4:
Result if I run the sql directly in my MS Access database:
Any idea please how to fix it?
Thanks!
I am adding one procedure populating a Datagrid into existing project; hereis the new, added code giving me an error message as above.
Code:
Private Sub Command14_Click()
Dim rst4 As ADODB.Recordset
Dim sSQL4 As String
If Combo1.Text = "Select Pay Period" Then
MsgBox "Select Pay Period!"
Exit Sub
End If
DataGrid4.ClearFields
sSQL4 = "SELECT [FULL_NAME], [WDATE], [WTYPE], [WHRS], [PCODE], [WRATE] FROM NAMES, WHOURS, PAYPER WHERE [NAMES].[EMPID]=[WHOURS].[EMPID] AND [PAYPER].[PAYPER]='" & Combo1.Text & "' AND [WHOURS].[PAYPER]=[PAYPER].[PPID];"
Debug.Print sSQL4
Set rst4 = New ADODB.Recordset
rst4.Open sSQL4, objAccessConnection, adOpenKeyset, adLockOptimistic
Set DataGrid4.DataSource = rst4
With DataGrid4
.Columns(0).Width = 2800
.Columns(1).Width = 1500
.Columns(2).Width = 1500
.Columns(3).Width = 500
.Columns(4).Width = 500
.Columns(5).Width = 500
End With
End Sub
Debug.print of the sSQL4:
SQL:
SELECT [FULL_NAME], [WDATE], [WTYPE], [WHRS], [PCODE], [WRATE] FROM NAMES, WHOURS, PAYPER WHERE [NAMES].[EMPID]=[WHOURS].[EMPID] AND [PAYPER].[PAYPER]='FEB 01-15' AND [WHOURS].[PAYPER]=[PAYPER].[PPID];
Result if I run the sql directly in my MS Access database:
Code:
FULL_NAME WDATE WTYPE WHRS PCODE WRATE
FOERTER, MYLES 2/05/19 R/T 7 55 16
FOERTER, MYLES 2/06/19 R/T 7 55 16
FOERTER, MYLES 2/07/19 R/T 7.5 55 16
FOERTER, MYLES 2/12/19 R/T 7.25 55 16
FOERTER, MYLES 2/14/19 R/T 8 55 16
Any idea please how to fix it?
Thanks!