A.D.Tejpal
adtp at touchtelindia.net
Wed Sep 8 14:27:36 CDT 2004
Arthur,
The following example might give you some working ideas. Let the datasheet form have 13 columns named F0 to F12.
The code given below will ensure that F5 is the column that gets focus and is the first unfrozen one.
It is observed that use of freeze feature interferes with the tab index property of various controls and normalization is not readily achieved by resetting the tab index. Hence the need for two stage loop (first loop normalizes the tab order of various columns).
A.D.Tejpal
--------------
=================================
Dim Cnt As Integer
' Normalize all columns
DoCmd.RunCommand acCmdUnfreezeAllColumns
For Cnt = 0 To 12
Me("F" & Cnt).SetFocus
DoCmd.RunCommand acCmdFreezeColumn
Next
DoCmd.RunCommand acCmdUnfreezeAllColumns
' Freeze Columns F0 to F4 and set focus on F5
For Cnt = 0 To 4
Me("F" & Cnt).SetFocus
DoCmd.RunCommand acCmdFreezeColumn
Next
Me("F5").SetFocus
=================================
----- Original Message -----
From: Arthur Fuller
To: 'Access Developers discussion and problem solving'
Sent: Wednesday, September 08, 2004 22:01
Subject: RE: [AccessD] Syntax question about control references
Hi. No it is not set to continuous forms. (Frankly, except for very limited situations, I HATE continuous forms, but that's another story.)
It's set for datasheet view. It's easy enough to set the focus to the
desired control, but that's only half what I need. I need to scroll the form such that the control with focus is in the first unfrozen position.
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Michael R
Mattys
Sent: Tuesday, September 07, 2004 10:59 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Syntax question about control references
----- Original Message -----
From: "Arthur Fuller"
> My form has controls whose names derive from the EoM() of a given
> date. That is, the end of a month. The control's name will be
> something such as "12/31/2004", etc. I need to set the focus to the
> column corresponding to today's date. For the date on which I am
> writing this message, the correct column is named "9/30/2004".
...
> The EoM() function (which I wrote) returns a date. I need to take this
> value and turn it into a reference to a column, such that I can write:
>
> Me.columnName.SetFocus
Arthur,
It looks like you mean to say that you have
a subform set to "continuous forms." If that's
the case, you'd say
Me.SubformName.Form.Controls("EOMDate").SetFocus
----
Michael R. Mattys
Mattys MapLib for Microsoft MapPoint
http://www.mattysconsulting.com