Tronsliver
Technical User
I have a query named qryVacantSlots with two fields: "orgstrPrNbr" and "strestrPosc" I also have a listbox named EfficiencyListBox. sqleff is defined as a global variable.
The SQL statement I'm using to populate the listbox is embedded in a Public Sub Below. The call I'm using to pass the two arguments to the procedure is:
Call Efficiency(643, Var2)
EfficiencyListBox.RowSource = sqleff
Var2 gets its assignment from clicking on the list box and assigning column 2 to the variable. When I run in debug and track the arguments I find that they are reaching the Sub. However, for some reason the SQL search on the two fields is not working. Var2 is defined as a "text" field in the original table. One last note, when I look at var2's variable in "watch" the variable is in quotes like this "92A00". I believe the problem is how I have the last two lines in the SQL string. Basically the way its suppose to work is:
The Sub takes the two varibales and conducts a search based on their value. In other words if varx = 648 and vary = 92A00 then show the information in the list box.
Sorry for the long explantion...Thanks for assisting.
Public Sub Efficiency(varx As Integer, vary As Variant)
sqleff = "SELECT qryVacantSlots.Available As Open,"
sqleff = sqleff + " qryVacantSlots.strestrPosc As DutyPos, "
sqleff = sqleff + " qryVacantSlots.strestrGrade As Grade,"
sqleff = sqleff + " qryVacantSlots.strestrauthparadsg As Para,"
sqleff = sqleff + " qryVacantSlots.strestrauthlinedsg As Line,"
sqleff = sqleff + " qryVacantSlots.orgstruname As Unit,"
sqleff = sqleff + " qryVacantSlots.orgstraddresscity As City"
sqleff = sqleff + " FROM qryVacantSlots WHERE qryVacantSlots.orgstrPrNbr"
sqleff = sqleff + " = '" & Format(varx) & "' "
sqleff = sqleff + " AND qryVacantSlots.strestrPosc = ' " & Format(vary) & "' "
End Sub
The SQL statement I'm using to populate the listbox is embedded in a Public Sub Below. The call I'm using to pass the two arguments to the procedure is:
Call Efficiency(643, Var2)
EfficiencyListBox.RowSource = sqleff
Var2 gets its assignment from clicking on the list box and assigning column 2 to the variable. When I run in debug and track the arguments I find that they are reaching the Sub. However, for some reason the SQL search on the two fields is not working. Var2 is defined as a "text" field in the original table. One last note, when I look at var2's variable in "watch" the variable is in quotes like this "92A00". I believe the problem is how I have the last two lines in the SQL string. Basically the way its suppose to work is:
The Sub takes the two varibales and conducts a search based on their value. In other words if varx = 648 and vary = 92A00 then show the information in the list box.
Sorry for the long explantion...Thanks for assisting.
Public Sub Efficiency(varx As Integer, vary As Variant)
sqleff = "SELECT qryVacantSlots.Available As Open,"
sqleff = sqleff + " qryVacantSlots.strestrPosc As DutyPos, "
sqleff = sqleff + " qryVacantSlots.strestrGrade As Grade,"
sqleff = sqleff + " qryVacantSlots.strestrauthparadsg As Para,"
sqleff = sqleff + " qryVacantSlots.strestrauthlinedsg As Line,"
sqleff = sqleff + " qryVacantSlots.orgstruname As Unit,"
sqleff = sqleff + " qryVacantSlots.orgstraddresscity As City"
sqleff = sqleff + " FROM qryVacantSlots WHERE qryVacantSlots.orgstrPrNbr"
sqleff = sqleff + " = '" & Format(varx) & "' "
sqleff = sqleff + " AND qryVacantSlots.strestrPosc = ' " & Format(vary) & "' "
End Sub