From: John on
Linq,
Thanks for the reply, but I did experiment with that.

My fault for not including the fact that I don't want to actually
select the value in the first data row, just move the selection highlite to
it.
From there the user can cursor down to their actual selection.

When the combo .dropdown occurs, nothing is selected.
The first down arrow it reveives, places it in the first data row.
I would imagine that Access considers that to be Row(0), as
headers may not count.
I'm just trying to send that down arrow (without sendkeys) to the combo,
and was surprised that I can't seem to find anything to do that.

Believe me, I'm not going to beat this to death. If there's no obvious
solution, everything works just fine, and one keystroke isn't that serious.
More of a "why not" question

Thanks,
John

"Linq Adams via AccessMonster.com" <u28780(a)uwe> wrote in message
news:a2f283972d291(a)uwe...
> To have it on the first row of data when opening the form and moving to
> the
> combobox
> :
> Private Sub Form_Load()
> Me.ComboBox = Me.ComboBox.ItemData(1)
> End Sub
>
> To have it on the first row of data each time you move to a different
> record,
> place the same code in the Form_Current event.
>
> --
> There's ALWAYS more than one way to skin a cat!
>
> Answers/posts based on Access 2000/2003
>
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access/201001/1
>


From: Dirk Goldgar on
"John" <newsgroups(a)microsoft.com> wrote in message
news:uJiowGroKHA.5260(a)TK2MSFTNGP02.phx.gbl...
>I forgot two critical items in my question.
> 1. cboOC1 is an unbound combobox
> 2. I don't want to select the first legitimate record, just
> position the selector there.


I think the closest you're likely to come is:

With Me.cboOC1
.SetFocus
.Value = .ItemData(0)
.Dropdown
End With

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

From: John on
Dirk,
Given the column heads, ItemData(0) = "OC"
which is the header for the bound column! I never realized
that the column heads were part of the dataset.

But, if you think that I'm not going to be able to easily move
the selector highlite to the first data row, then that's what I needed to
know.

It just seemed odd that there wasn't an obvious way to do that, and that's
why I asked.
I'm not going to fight Access on this one. Not for just one keystroke.
Thanks
John M

"Dirk Goldgar" <dg(a)NOdataSPAMgnostics.com.invalid> wrote in message
news:efLBgSroKHA.5700(a)TK2MSFTNGP04.phx.gbl...
> "John" <newsgroups(a)microsoft.com> wrote in message
> news:uJiowGroKHA.5260(a)TK2MSFTNGP02.phx.gbl...
>>I forgot two critical items in my question.
>> 1. cboOC1 is an unbound combobox
>> 2. I don't want to select the first legitimate record, just
>> position the selector there.
>
>
> I think the closest you're likely to come is:
>
> With Me.cboOC1
> .SetFocus
> .Value = .ItemData(0)
> .Dropdown
> End With
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>



From: Dirk Goldgar on
"John" <newsgroups(a)microsoft.com> wrote in message
news:%23y4QC0soKHA.1552(a)TK2MSFTNGP04.phx.gbl...
> Dirk,
> Given the column heads, ItemData(0) = "OC"
> which is the header for the bound column! I never realized
> that the column heads were part of the dataset.

Did you check to verify that that was the case? In my test, using a combo
box with column heads (Access 2003), .ItemData(0) was still the value of the
first data row, not the header. But if this:

>> .Value = .ItemData(0)

.... doesn't work for you, you should be able to use the .ListIndex property:

.ListIndex = Abs(.ColumnHeads)

That should work whether the column headers are present or not.

> But, if you think that I'm not going to be able to easily move
> the selector highlite to the first data row, then that's what I needed to
> know.

One or another of the code options I posted will work, so long as you
understand that, with a combo box, there is no built-in way to highlight a
row without effectively setting the combo box's value to that row. The best
you can do (without some really elaborate Windows API programming) is to
select the row and then do the .Dropdown.

> It just seemed odd that there wasn't an obvious way to do that, and that's
> why I asked.
> I'm not going to fight Access on this one. Not for just one keystroke.

Depending on what you want, the above approach may be fine for you.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

From: John on
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.

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."

> understand that, with a combo box, there is no built-in way to highlight a
> row without effectively setting the combo box's value to that row...
At this point, I would agree, and I'm grateful for your concurrence in that.

Thanks Dirk,
John M

"Dirk Goldgar" <dg(a)NOdataSPAMgnostics.com.invalid> wrote in message
news:ORh1ZQtoKHA.1544(a)TK2MSFTNGP02.phx.gbl...
> "John" <newsgroups(a)microsoft.com> wrote in message
> news:%23y4QC0soKHA.1552(a)TK2MSFTNGP04.phx.gbl...
>> Dirk,
>> Given the column heads, ItemData(0) = "OC"
>> which is the header for the bound column! I never realized
>> that the column heads were part of the dataset.
>
> Did you check to verify that that was the case? In my test, using a combo
> box with column heads (Access 2003), .ItemData(0) was still the value of
> the first data row, not the header. But if this:
>
>>> .Value = .ItemData(0)
>
> ... doesn't work for you, you should be able to use the .ListIndex
> property:
>
> .ListIndex = Abs(.ColumnHeads)
>
> That should work whether the column headers are present or not.
>
>> But, if you think that I'm not going to be able to easily move
>> the selector highlite to the first data row, then that's what I needed to
>> know.
>
> One or another of the code options I posted will work, so long as you
> understand that, with a combo box, there is no built-in way to highlight a
> row without effectively setting the combo box's value to that row. The
> best you can do (without some really elaborate Windows API programming) is
> to select the row and then do the .Dropdown.
>
>> It just seemed odd that there wasn't an obvious way to do that, and
>> that's
>> why I asked.
>> I'm not going to fight Access on this one. Not for just one keystroke.
>
> Depending on what you want, the above approach may be fine for you.
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>


First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: LACCDB file won't release
Next: subseribe