What am I doing wrong?

Kiwi-Wombat

Registered User.
Local time
Today, 06:39
Joined
Aug 2, 2004
Messages
56
I want to assign a Listbox to a variable (the listbox name not the contents) e.g.

Dim SelectedList as as ListBox
Select Case whatever
case 1
SelectedList = ListBoxName
goto OtherCode
case 2 etc
End select

OtherCode:
SelectedList.Requery

The error message I get is "Method or data member not found". This stops on SelectedList in OtherCode

I tried Dim SelectedList as String but that didn't work either

Any help would be appreciated
 
kiwi,

Don't know what you're trying to do. If you had a ListBox, you can
pass it to a function as a listbox.

If you are in some code, the name of the listbox should be available
to you.

No idea here, before I go off on a tangent, more info please.

Wayne
 
I am not sure I can describe it any other way.

If my code is not clear to anyone please let me know and I'll upload a sample
 
I have been given an answer in another forum and I'll post it here for anyone that needs it

code:---------------------------------------------------------------------
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim SelectedList As String
Dim RelevantField As String

Set db = CurrentDb
Set rst = db.OpenRecordset("tblEmployee")
SelectedList = "lstEmployee"
RelevantField = "EEName"

With rst
.AddNew
rst(RelevantField) = "whatever"
.Update
End With
Me(SelectedList).Requery

Set rst = Nothing
Set db = Nothing
----------------------------------------------------------------------


__________________
 

Users who are viewing this thread

Back
Top Bottom