Normally when I generate the data with a form, all the 20 fields will appear on the table.
Now i want to use checkbox to allow user to choose which column to appear.
I have got this:
Expand|Select|Wrap|Line Numbers
- Private Sub genQuery()
- sqlStr = "SELECT"
- MsgBox sqlStr
- If Me.[1] = True Then
- sqlStr = sqlStr & " Table.ColumnA "
- Else
- sqlStr = sqlStr & " Table.ColumnA "
- End If
- If Me.[2] = True Then
- sqlStr = sqlStr & " Table.ColumnB "
- Else
- sqlStr = sqlStr & " Table.ColumnB "
- End If
- If Me.[3] = True Then
- sqlStr = sqlStr & " Table.ColumnC "
- Else
- sqlStr = sqlStr & " Table.ColumnC "
- End If
.
.
However, it says
"Syntax Error (missing operator) in query expression"
How may I solve it?
I am using Access 2007
Thank you!