|
-
May 7th, 2001, 09:02 AM
#1
Can anyone answer this?
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?
-
May 7th, 2001, 09:06 AM
#2
Re: Can anyone answer this?
Try this
Private Sub Combo1_Click()
glocurrProjNum = Combo1.Text
End Sub
Iouri Boutchkine
[email protected]
-
May 7th, 2001, 09:24 AM
#3
Re: Can anyone answer this?
Thanks Iouri. Your post plus David's helped me solve this problem.
-
May 7th, 2001, 09:25 AM
#4
I can
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
[email protected]
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|