W
Wendy
Hi
I want the button to fill a text box with the data from the table as
selected by which value is selected from the list box. It shows #Name? in
the text box Txtblvalues, and when I look at controlsource of the
Txtblvalues it does show the strSQL . I think it is a syntax error but, it
works fine in a query.
Thanks
Wendy
Public Sub btnGo_Click()
Dim TblName As String
Dim strSQL As String
If Me.LstBoxAC.Value = "NLC" Then TblName = "TblNLC"
If Me.LstBoxAC.Value = "HU" Then TblName = "TblHU"
strSQL = "SELECT TOP 1 [" & TblName
strSQL = strSQL & "].* FROM [" & TblName
strSQL = strSQL + "]"
Me.Txtblvalues.ControlSource = strSQL
End Sub
I want the button to fill a text box with the data from the table as
selected by which value is selected from the list box. It shows #Name? in
the text box Txtblvalues, and when I look at controlsource of the
Txtblvalues it does show the strSQL . I think it is a syntax error but, it
works fine in a query.
Thanks
Wendy
Public Sub btnGo_Click()
Dim TblName As String
Dim strSQL As String
If Me.LstBoxAC.Value = "NLC" Then TblName = "TblNLC"
If Me.LstBoxAC.Value = "HU" Then TblName = "TblHU"
strSQL = "SELECT TOP 1 [" & TblName
strSQL = strSQL & "].* FROM [" & TblName
strSQL = strSQL + "]"
Me.Txtblvalues.ControlSource = strSQL
End Sub