Here lstName is a name of a list box in Access form.
Private Sub cmdUp(lstName As String, SQLName As String, IDName As String, ColumnName As String)
Dim sText As String
Dim pText As String
'check: only proceed if there is a selected item
If lstName.ItemsSelected.Count = 1 Then
(...)
After calling a procedure:
Call cmdUp(lstSchemaName.Name, "eo_ListSchema", "SchemaID", "SchemaName")
I get error it this line:
If lstName.ItemsSelected.Count = 1 Then
Error is:
Invalid Qualifier
So basically VBA cannot understant that lstName. is a list from which it should find how many items are selected.
I found that in VBA “strings are not objects, so there are no methods on the string variable that you can call”.
There should be a simple solution, but I cannot find it. How to deal with this kind of problem?
Any help is highly appreciated!
Edgaras
lstNameas you’ve passed it in will just be the string name of your listbox, not the actual listbox instance.As this
lstNameis a string, callinglstName.ItemsSelectedisn’t valid.You should be able to pass the listbox in instead:
Then call this using: