Prev: LACCDB file won't release
Next: subseribe
From: Dirk Goldgar on 1 Feb 2010 00:04 "John" <newsgroups(a)microsoft.com> wrote in message news:uBj$QivoKHA.1548(a)TK2MSFTNGP02.phx.gbl... > Dirk, > Yes, I did test your code (Access 97, unbound combo) > With Me.cboOC1 > .SetFocus > .Value = .ItemData(0) > .Dropdown > End With > gave me "OC" (the header) for a combo value. > ItemData(1) gave me 16955, the first real value. Interesting. This appears to be different between Access 97 and Access 2003. > This code: > With Me.cboOC1 > .SetFocus > .ListIndex = Abs(.ColumnHeads) > .Dropdown > End With > gave me a R/T 7777 error "You used the ListIndex property improperly." Another difference. Given these results, I'd suggest you use the .ItemData property, but indexed by Abs(.ColumnHeads): With Me.cboOC1 .SetFocus .Value = .ItemData(Abs(.ColumnHeads)) .Dropdown End With But I understand that you may have decided to give up on the idea completely. -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup)
From: John on 1 Feb 2010 08:07
Dirk, I'll try both your suggestions in 2003, and try to get back to you on this thread. Having some work done in the office this week, and may have to break the PC down for a few days. I'll also try your code with a bound combo to see if that might make a difference. Always thought combo headers weren't part of the dataset, so I was surprised too. Yes, on this issue, I'm inclined to just let it go, as far as my app is concerned. Thanks, John "Dirk Goldgar" <dg(a)NOdataSPAMgnostics.com.invalid> wrote in message news:OGsEdwvoKHA.1552(a)TK2MSFTNGP05.phx.gbl... > "John" <newsgroups(a)microsoft.com> wrote in message > news:uBj$QivoKHA.1548(a)TK2MSFTNGP02.phx.gbl... >> Dirk, >> Yes, I did test your code (Access 97, unbound combo) >> With Me.cboOC1 >> .SetFocus >> .Value = .ItemData(0) >> .Dropdown >> End With >> gave me "OC" (the header) for a combo value. >> ItemData(1) gave me 16955, the first real value. > > Interesting. This appears to be different between Access 97 and Access > 2003. > >> This code: >> With Me.cboOC1 >> .SetFocus >> .ListIndex = Abs(.ColumnHeads) >> .Dropdown >> End With >> gave me a R/T 7777 error "You used the ListIndex property improperly." > > Another difference. Given these results, I'd suggest you use the > .ItemData property, but indexed by Abs(.ColumnHeads): > > With Me.cboOC1 > .SetFocus > .Value = .ItemData(Abs(.ColumnHeads)) > .Dropdown > End With > > But I understand that you may have decided to give up on the idea > completely. > > -- > Dirk Goldgar, MS Access MVP > Access tips: www.datagnostics.com/tips.html > > (please reply to the newsgroup) > |