Hi,
I am trying to get a bit of code to work but am not successful doing so. I get a runtime error 3141 telling me my select statement contains a reserved word, misspelled word, punctuation missing or incorrect.
Below is the code but I cannot find what is wrong with it. Any help would be really appreciated.
Option Compare Database
Option Explicit
Public wSort As String
Public wField As String
Const Sort1 = "SELECT tbl_tmp_Metrics_1yr_Captured_New.Barcode, FROM tbl_tmp_Metrics_1yr_Captured_ATS "
Private Sub Form_Open(Cancel As Integer)
wField = "Barcode"
wSort = " ASC"
End Sub
Private Sub Label2_Click()
wField = "Barcode"
Sortiraj
End Sub
Sub Sortiraj()
If wSort = " ASC" Then
wSort = " DESC"
Else
wSort = " ASC"
End If
Me.RecordSource = Sort1 & "ORDER BY tbl_tmp_Metrics_1yr_Captured_New." & wField & wSort & ";"
End Sub
I am trying to get a bit of code to work but am not successful doing so. I get a runtime error 3141 telling me my select statement contains a reserved word, misspelled word, punctuation missing or incorrect.
Below is the code but I cannot find what is wrong with it. Any help would be really appreciated.
Option Compare Database
Option Explicit
Public wSort As String
Public wField As String
Const Sort1 = "SELECT tbl_tmp_Metrics_1yr_Captured_New.Barcode, FROM tbl_tmp_Metrics_1yr_Captured_ATS "
Private Sub Form_Open(Cancel As Integer)
wField = "Barcode"
wSort = " ASC"
End Sub
Private Sub Label2_Click()
wField = "Barcode"
Sortiraj
End Sub
Sub Sortiraj()
If wSort = " ASC" Then
wSort = " DESC"
Else
wSort = " ASC"
End If
Me.RecordSource = Sort1 & "ORDER BY tbl_tmp_Metrics_1yr_Captured_New." & wField & wSort & ";"
End Sub