Click to See Complete Forum and Search --> : Can anyone answer this?
privateagentx
May 7th, 2001, 09:02 AM
I have a dropdown data combo box that lists a project number. I want to be able to select a project number in the combo box then assign it to a global variable. The project number, lets say 8815, should then be stored in the global variable gloCurrProjNum. I've written the code but i keep getting the list number (1) instead of the actual project number (8815). Heres the code:
Private Sub DataCombo1_Click(Area As Integer)
If Area = dbcAreaList Then
glocurrProjNum = DataCombo1.SelectedItem
End If
End Sub
Can anyone see what i'm doing wrong?
Iouri
May 7th, 2001, 09:06 AM
Try this
Private Sub Combo1_Click()
glocurrProjNum = Combo1.Text
End Sub
Iouri Boutchkine
iouri@hotsheet.com
privateagentx
May 7th, 2001, 09:24 AM
Thanks Iouri. Your post plus David's helped me solve this problem.
Cakkie
May 7th, 2001, 09:25 AM
The selecteditem property doesn't return the value, but it returns a bookmark from the recordset which is in the rowsource property (most likely a datacontrol or a recordset).
You can get the value this way:
private Sub DataCombo1_Click(Area as Integer)
If Area = dbcAreaList then
dim bm as variant
bm = DataCombo1.SelectedItem
' assuming that the rowsource is named data1
' and the inputcolumn is projectnumber
data1.recordset.bookmark = bm
glocurrProjNum = data1.recordset.fields("projectnumber")
End If
End Sub
Tom Cannaerts
slisse@planetinternet.be
Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.