I would use an expression for the background color.
You don't want the unbound control to get the focus, that is the reason for
the code in the GotFocus event. Marshall's idea of disabling the control is
really a pretty good one. You could give the set the controls backcolor
using conditional formatting, and then when you disable it, that will make it
a little duller color. But overall a pretty good idea.
The challenge will be the sequentially numbered field. Autonumber fields do
not guarantee that they will be generated sequentially, and even if they did,
that doesn't account for records that get deleted. So in order for this
method to work, you will need to add another field (long integer) to your
underlying recordset which you could update before opening the form, OR, you
would have to add a column to your record sources query, something like:
SeqNumber: (SELECT Count(*) FROM yourTable as T WHERE T.[PKField] < =
yourTable.[PKField])
The problem with either of these is that they could be time consuming, and
neither one will work if you filter the form after loading the recordset.
----
HTH
Dale
"ThriftyFinanceGirl" wrote:
> Using 2003, they haven't upgraded here yet. However, I think I can use the
> box in the background. However, using conditional formatting you can set a
> field that has focus in a datasheet a certain backcolor. Then you could set
> the other fields with a conditional formatting also? But it would have to be
> an expression. I guess that is what you guys are all saying can't be done?
>
> "Dale Fye" wrote:
>
> > Need to be a little more specific.
> >
> > What version of Access are you using? If A2007, then the details section of
> > both reports and forms contain a "Alternate Back Color" property. Just set
> > the color of this property to achieve your goal.
> >
> > If you are using an earlier version of Access, it becomes a little more
> > difficult (at least I don't remember earlier versions containing this
> > property). If you have a field in your forms RecordSource (table or query)
> > which contains a sequential numeric value (you could call this a row number),
> > then you could:
> > 1. Create an unbound textbox and size it to span the entire width and
> > height of the detail section.
> > 2. You will then have to move it to the background (I think 2003 has this
> > ability) by right clicking on the textbox and selecting - Position -> Send to
> > Back from the popup menu. You may also have to select each of the other
> > controls and bring them to the front.
> > 3. Then set its Tab Stop property to No
> > 4. In the controls GotFocus event, set the focus to one of the other
> > controls in the details section of the form.
> > 5. Finally, set the conditional formatting for that text box so that the
> > condition is based on an expression. The expression will look something like:
> >
> > Same technique will work for a report, although you won't have to do steps 3
> > and 4 in a report. Another method in a report would be to use the Format
> > event of the detail section. Add the following code to that event to get
> > alternate color backgrounds.
> >
> >
> > Static RowCount As Long
> >
> > RowCount = RowCount + 1
> > Me.Section(acDetail).BackColor = IIf(RowCount Mod 2 = 0, RGB(255, 255,
> > 255), RGB(236, 250, 252))
> >
> >
> > ----
> > HTH
> > Dale
> >
> >
> >
> > "ThriftyFinanceGirl" wrote:
> >
> > > How can I get an entire row to highlight instead of just one field?
|