By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,084 Members | 1,969 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,084 IT Pros & Developers. It's quick & easy.

Make a Datasheet like List Box

P: n/a
I have a datahsheet form. It is used as a sub-form within a main
form. When moving within the datasheet sub-form the cursor goes from
one field to the next (left to right if pressing the right arrow key
and vica versa). Is it possible to make it work like a list box?
What I mean is that only rows are highlighted, not individual fields.
You can do this in VB6 with a MSFlexGrid.
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Paul wrote:
I have a datahsheet form. It is used as a sub-form within a main
form. When moving within the datasheet sub-form the cursor goes from
one field to the next (left to right if pressing the right arrow key
and vica versa). Is it possible to make it work like a list box?
What I mean is that only rows are highlighted, not individual fields.
You can do this in VB6 with a MSFlexGrid.


I suppose you can Enabled = No and set the Locked = Yes to the fields
but the one field you want to scroll on.
Nov 13 '05 #2

P: n/a
> I suppose you can Enabled = No and set the Locked = Yes to the fields
but the one field you want to scroll on.


That's not a bad idea. However, that is not really what I am looking
for. I am using the datasheet for display only. No update is needed
for the data. I want the user to be able to scroll through the
records and stop on the record they want to select...possibly have a
double-click event that allows them to process a record, or have a
button to process the record selected.

I was able to do it successfully by using the following code within
the datasheet form:

Private Sub Form_Current()
On Error Resume Next
Form.SelLeft = 1
Form.SelWidth = 99
Err.Number = 0
End Sub

However, I had to add the "On Error Resume Next" and "Err.Number = 0"
because it would generate errors if the datasheet didn't have focus
(i.e.: I have multiple datasheets on my main form housed in a tab
control). Even when the errors are generated, it still does what I
want.

So, I got it to work. Would anyone know a better way?
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.