Highlight current record in split form

spikepl

Eledittingent Beliped
Local time
Today, 01:27
Joined
Nov 3, 2010
Messages
6,142
I want to highlight the current record in the datasheet of a split form (Access 2007).

To that end, in the form's OnCurrent, I have put:

Code:
SendKeys "+ ", True

It works fine, once the user clicks on a row somewhere in the datasheet. But when the form loads, the first row in the datasheet, the current row, is not highlighted. Only if I navigate to it later in the datasheet-part.

I put the coad in the OnLoad, but that does not do it either.

Any suggestions?
 
I don't use Spilt Forms (they suck) but this works in a Datasheet:
DoCmd.RunCommand acCmdSelectRecord

SendKeys should be avoided and only used as a last resort.
 
"Split Forms (they suck)" - in what way?
"SendKeys should be avoided and only used as a last resort.", because?

I replaced my SendKeys with DoCmd.RunCommand acCmdSelectRecord, but when I open the form, the current record still isn't highlighted. Any other suggestions?
 
"Split Forms (they suck)" - in what way?

Split forms are a useful beginners' tool but they come with some limitations.

In a split form the "datasheet" and the "single form" sections are two views of the same control. This is inevitably going to lead to an inability to separately set the properties in each view.

I only have a single experience with split forms and this revealed a weakness.

http://www.access-programmers.co.uk/forums/showthread.php?t=200972

I don't know if there are other parts of its VBA that don't work properly but this one is enough to condemn them.

The same appearance can be achieved with a subform without sacrificing functionality.

"SendKeys should be avoided and only used as a last resort.", because?

Most actions can be achieved through using a Method where it is directed specifically by the context of the command. Send keys relies on the focus being exactly where it is expected.

I replaced my SendKeys with DoCmd.RunCommand acCmdSelectRecord, but when I open the form, the current record still isn't highlighted. Any other suggestions?

The command works when used in a datasheet because it can be specifically directed to the datasheet as an object by setting the focus there. AFAIK, in a split form there is no way to direct the focus separately to the datasheet section.

Perhaps this is split form weakness number two?
 
Thanks for the info regarding split forms. I thought why bother making the stuff myself, since it came here on a platter ... Elsewhere I have some subforms, and there I have no problem highlighting the current record.

I have experienced some weird behaviour with the ESC-key ... eventually I had to disable it. Perhaps this too is a "feature" of split forms? http://www.access-programmers.co.uk/forums/showthread.php?t=201322
 
I believe they are highlighted but you just don't notice it. The default highlight colour is very pale blue and as a result not visibly noticeable.

Note that the alternate colour of the first row is White.
 
In 2007 there is an orange box around the highlighted record - very noticable.
 
You're talking about when you click on the lhs record selector? That kind of highlighting feature?
 
I've sent Access Team Member (SDET) Jeff Conrad a message asking him to chime in on this and the referenced threads. Hopefully he will stop in soon and do so. He might be able to shed some light on how split forms can be used programmatically with not so much trouble (we can only hope). :)

I think one problem here is getting used/accustomed/experienced with new functionality.

having done something a certain way for many years its often difficult to get used to a new way of doing stuff. and it certainly wouldn't be easy to update any large apps. (which is why there is so much legacy software generally)

furthermore, the problem with some stuff is that it works because Access has been modified to provide this solution, which is then not scalable to a different back end database.

if you come to access 2010 straight away, no doubt you get used to what you get.

eg - I find it infuriating in A2007 that i cannot (easily) select a single control on a form, and reposition it. Why WOULD they remove that facility? Who do these improvements benefit?
 
#11 Yes.

#12 I have no particualr prefeence for "old ways" vs. "new ways" - whatever works, and whatever provides me with any shortcuts to the goal. But, when things start behaving weirdly, and some functionality is either no longer accessible, or requires strange tricks... :-)

I tend to blame myself first, and seldom the s/w ... but I have so far never experienced to have to recover my entire machine from backup to obtain a stable environment. That is, until A2007 crashed a few times :-(
 
I find it infuriating in A2007 that i cannot (easily) select a single control on a form, and reposition it. Why WOULD they remove that facility? Who do these improvements benefit?

Do you mean the way the controls default to Stacked Layout when a form is created by the wizard? I rarely use the wizard to make a form but when I do the first thing I do is select everything and remove the layout setting.

Would be nice if controls could be selected and then locked together in a group while maintaining their relative position.

Or do you mean the way that a selected control doesn't drag but goes into controlsource edit unless you click outside first?

Or the way the label moves with the contol unless you grab it by the little brown handle? I guess that is better than loosing the relative positioning of the lablel by moving the control independently.

What I would like is the ability to connect a lablel to a control at any time not just when it is made. Also it is a pity the control to connect can only be picked from a list rather than simply clciked with the mouse. Also the ability to connect multiple labels to one control would be handy sometimes like when you want say a title label and a unit label.
 
Do you mean the way the controls default to Stacked Layout when a form is created by the wizard? I rarely use the wizard to make a form but when I do the first thing I do is select everything and remove the layout setting.

Would be nice if controls could be selected and then locked together in a group while maintaining their relative position.

Or do you mean the way that a selected control doesn't drag but goes into controlsource edit unless you click outside first?

Or the way the label moves with the contol unless you grab it by the little brown handle? I guess that is better than loosing the relative positioning of the lablel by moving the control independently.

What I would like is the ability to connect a lablel to a control at any time not just when it is made. Also it is a pity the control to connect can only be picked from a list rather than simply clciked with the mouse. Also the ability to connect multiple labels to one control would be handy sometimes like when you want say a title label and a unit label.

You can do this, can't you. You could up to A2003. Cut the label. Select the control. Paste the label back. Now the label is attached to the control.

not sure is A2007 changed this.
 
You can do this, can't you. You could up to A2003. Cut the label. Select the control. Paste the label back. Now the label is attached to the control.

In 2007 this adds a new unassociated label and offers options in an alert box. Choosing to associate the label with the control automatically removes the association of the original label.
 
Was this ever resolved as I have the same problem!
 
In Access 2007 this can definitely be done with conditional formatting.

- create a query and duplicate the columns to appear in the datasheet. (DS_Field1: Form_Field1) where Form_Field1 is the field name of the table
- from that query create a split form read-only datasheet
- on the form add conditional formatting to all DS_xxxx fields and put their visible property to false
- on the datasheet hide all columns belonging to the main form (Form_Fieldx)

Don't know if this is still of interest, as the thread is quite old. Don't know if more recent versions of Access handle this in a better way.

Reply to this post if still interested and I will post a working example here.

/Ben
 

Users who are viewing this thread

Back
Top Bottom