Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Box Value is always NULL Even though List Box is populated

Status
Not open for further replies.

jimbo62

Technical User
Oct 19, 2002
43
0
0
US
I have an unbound form (Microsoft Access 2000 ADP/SQL Server 2000) which has a list box containing values from a Views'Single field (only 1 field for Flagging). When the value is Y, I intend to turn OFF an overlayed image on the form. The value in the local window is always "null" no matter what I try. Am I missing something maybe to make the value visible to access.

Here is my code I have tried just about everything and am exhauseted it has to be so simple it will hurt....

Private Sub Form_Activate()

Forms!MainDashboard.List77.SetFocus

If Forms!MainDashboard.List77.Value = "Y" Then

Forms!MainDashboard.Image82.Visible = False

End If

End Sub


Thanks all who reply...


Jim

Jimbo[bigsmile]
 
What is the record source for the listbox? You could put a Debug.Print statement in your code and see what is in the value. I am not sure the listbox gets loaded in the Active Event, maybe try the OnOpen Event.
 
I have tried Current, Activate, On Load. It appears to never get a value. The debug print never puts any value in the window when I go down to the Locals Window and ferret out the value it says null on every step of the code???

I can turn on and off the images in code but not looking at the value from the list box base don the view??

I appologize for any ignorance Might Display I am concerned and somewhat confused.

is it possible that I need to populate this alue with some type of SQL or expression rather than trying to get the value from the list box?


Thanks,

Jimbo[bigsmile]
 
I don't understand what is in the listbox. Normally, the listbox would have a record source that would give you a list of values. What is the record source for the listbox?
 
The List Box has a record Source based on a View from SQL Server 2000 the value is Y or N. I Just want to get the current value evaluate it and display or not display an image based on the value in the list box. I chose a list box because it is simple to populate a value on the unbound form.

I hope that explains the situation Thank you for your attention..

Jimbo[bigsmile]
 
The user would interact with the listbox by selecting a value from the drop down list. So, you can put code in the Events associated with the listbox not the Form.
 
I found the answer to my problem. I was being bull headed and did not want to bind the form to any views. I tried it and referenced the text field.

It Worked!!

To my amazement nothing else was affected by my binding the form to the view.

Does anyone know how this can be done programmatically?

Thanks to all who assisted me in my quest...
[dazed][dazed][dazed][dazed]

Thanks All

Jimbo[bigsmile]
 
Thanks for the assistance cmmrfrds. The view is looking at cutoff time in a warehouse production db. When the value is exceeded the text in view and the fields change to Y or N. I wanted to keep the entire for unbound and freeform so to speak.

Thanks,

Jimbo[bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top