David Trickett
Registered User.
- Local time
- Today, 21:52
- Joined
- Nov 20, 2002
- Messages
- 16
This was covered a while ago, but I can't get the solution to work!
It involved the line
Me.cboPosition = Me.cboPosition.Column(0, N)
But "cboPosition" just won't compile.
I need to select one item in a combo box when the form is loaded depending on a variable already set.
Thus from the calling procedure currentusername="Fred"
The code in Excel vba would look like this:
For thisitem = 0 to Combo1.ListCount
If Combo1.List(thisitem)=currentusername then
Combo1.ListIndex=thisitem
Exit for
End If
Next thisitem
And if Fred is in the list he will be selected.
But of course this doesn't work with Access vba since ListIndex is read only (do MS programmers ever talk to each other?).
Any help would be much appreciated.
Thank you
David Trickett
It involved the line
Me.cboPosition = Me.cboPosition.Column(0, N)
But "cboPosition" just won't compile.
I need to select one item in a combo box when the form is loaded depending on a variable already set.
Thus from the calling procedure currentusername="Fred"
The code in Excel vba would look like this:
For thisitem = 0 to Combo1.ListCount
If Combo1.List(thisitem)=currentusername then
Combo1.ListIndex=thisitem
Exit for
End If
Next thisitem
And if Fred is in the list he will be selected.
But of course this doesn't work with Access vba since ListIndex is read only (do MS programmers ever talk to each other?).
Any help would be much appreciated.
Thank you
David Trickett