Get value from a single row listbox. (1 Viewer)

jason_nevin

Registered User.
Local time
Today, 01:05
Joined
Nov 22, 2002
Messages
46
I've got a listbox control on a form which I'm populating with a query each time the form is loaded. The query will only ever select one row. I would like to place the contents of the Listbox control into a string but I'm having real problems. Despite the fact that I can see a value in the box I only ever get a null return.

Here is my code;

If IsNull(Forms![frmBulkIDAnalysis]![EmailAddress]) Then
strEmailAddress = InputBox("Please supply an E-mail address")
If Len(strEmailAddress) = 0 Then
MsgBox "No Email address supplied, message not sent"
Exit Sub
End If
Else
strEmailAddress = Forms![frmBulkIDAnalysis]![EmailAddress]
End If


I've also used the following code to ensure that my value is selected (it is highlighted on the form);

Me!EmailAddress.Selected(0) = True

Any ideas?
 

PaddyIrishMan

Registered User.
Local time
Today, 01:05
Joined
Jun 5, 2002
Messages
166
I think if you reference the .list method of the listbox you will get the value back. I.e MyList.List(0)

Regards,
Patrick
 

Users who are viewing this thread

Top Bottom