A
andrew hudson via AccessMonster.com
Hi....I am slowly cracking up....
I have a form with six list boxes on. Four of the list boxes contain numeric data and passing this info to a variable isn't a problem. Two of the list boxes contain strings and I cannot pass the selected string to a variable. For example in the subroutine below I am trying to capture the selected item in the listbox LstLeague to the variable strLeague and then use this variable in an embedded SQL statement to update a new table. This however is not working. Anyone any ideas?
Private Sub btnUpdate_Click()
Dim mySQL As String
Dim strAge As Variant
Dim strLeague As Variant
'Dim strLevel As Variant
'Dim strPos As Variant
Set strAge = Forms!PlayerStats.[LstAge]
Set strLeague = Forms!PlayerStats.[LstLeague]
mySQL = mySQL + "Select *"
mySQL = mySQL + " INTO PlayerSummaryTable"
mySQL = mySQL + " FROM PlayerStats"
mySQL = mySQL + " WHERE PlayerAge = " & strAge & "AND leaguename =" & Chr(34) & strLeague & Chr(34) & ";"
I have a form with six list boxes on. Four of the list boxes contain numeric data and passing this info to a variable isn't a problem. Two of the list boxes contain strings and I cannot pass the selected string to a variable. For example in the subroutine below I am trying to capture the selected item in the listbox LstLeague to the variable strLeague and then use this variable in an embedded SQL statement to update a new table. This however is not working. Anyone any ideas?
Private Sub btnUpdate_Click()
Dim mySQL As String
Dim strAge As Variant
Dim strLeague As Variant
'Dim strLevel As Variant
'Dim strPos As Variant
Set strAge = Forms!PlayerStats.[LstAge]
Set strLeague = Forms!PlayerStats.[LstLeague]
mySQL = mySQL + "Select *"
mySQL = mySQL + " INTO PlayerSummaryTable"
mySQL = mySQL + " FROM PlayerStats"
mySQL = mySQL + " WHERE PlayerAge = " & strAge & "AND leaguename =" & Chr(34) & strLeague & Chr(34) & ";"