Highlight alternate field in datasheet form

Steve Hebert

New member
Local time
Today, 06:24
Joined
Oct 7, 2008
Messages
6
I have an order form that runs in datasheet view.

What I would like to do is when I scroll down the 'qty ordered' column I would like the 'description' field that it applies to to be highlighted. (no particular color)

I am not new to Access but have pretty much stuck with macros - queries - and have little experience with actual VBA.

Any help would be appreciated.
 
As far as I know Steve, you can't do that sort of thing when in Datasheet view. You are at the mercy of MS-Access when it comes to the design of the Datasheet. Yes, you can change Cell Spacing (overall), Font Size (overall) and Cell Color (overall) and really, that's about it.

If you want full flexibility over the look and feel of a Datasheet Form then you will need to create your own which isn't all that hard to do. You just need to get a little.....artsy. :)

- Set your Forms' Default View property to Continuous Forms.
- Enable the Form Head And Footer.

- Delete the Child Labels associated with the controls within the Details section of the Form.

-Slide the controls up tight against the bottom of the Details Group Bar and align them as you would like to view them (like they would be in a Datasheet).

- Add Labels to the Form Header Group and give them captions to represent the Data tat will be displayed in the Controls located within the Details Group. Be sure to align those labels tight up against the top of the Form Header Group Bar and directly above their respective Controls located in the Details Group.

- Slide the Detail Group Bar up tight against the bottom of the Labels located within the Form Head Group Section.

- Slide the Form Footer Group Bar up tight against the bottom of the Controls located within the Detail Group Section.

- Make sure no part of the Form Footer Group section is visible. Slide the Form Footer Section Backdrop up tight against the Bottom of the Form Footer Group Bar.

- Save the Form and Run it.

It should look like a Datasheet except now, you can add buttons, color whatever you like and apply Conditional Formating, etc.. Far more flexibility to make your Form look and feel the way you want.

.
 
Appreciate the response.

If I use continuous form I still have the same question.
How do a make the 'description' field be highlighted in a specific color when the 'Quantity Ordered" field has the focus?
 
Here is how.....

- Set the Back Color property for the Detail section of your Form to oh....let's say white.

- Set the Back Color for all the Form Fields to a color you would like them to have should that particular control have focus (let's say Cyan for now).

- Set the Back Style property of all your your Controls on Form to Transparent.

- Select the Quantity Ordered Form Field - Go to the Event tab within the Properties Window.

- Go to the On Got Focus Event property for the Quantity Ordered Control and double-click in the your mouse pointer inside the property box. It should change to [Event Procedure].

- To the far right of the On Got Focus Property box is a small button with 3 dots in it - click on it - the VBA Editor will open and the editing caret will be located within a Got Focus code event procedure.

- Copy and paste this code into that procedure:

Me.Description.BackColor = vbRed
Me.Description.ForeColor = vbYellow
Me.Description.BackStyle = 1 'Solid

- Exit the VBA editor

- Go to the On Lost Focus Event property for the Quantity Ordered Control and double-click in the your mouse pointer inside the property box. It should change to [Event Procedure].

- To the far right of the On Lost Focus Property box is a small button with 3 dots in it - click on it - the VBA Editor will open again and the editing caret will be located within a Lost Focus code event procedure.

- Copy and paste this code into that procedure:

Me.Description.BackColor = vbWhite
Me.Description.ForeColor = vbBlack
Me.Description.BackStyle = 0 'Transparent

- Exit the VBA Editor - Save your Form

- You are Done! - Run your Form and place focus onto the Quantity ordered Text Box. Then place focus somewhere else.

Please note: The example above assumes that the Description Text Box Field on Form is actually named Description. If it doesn't then you will need to change the code above to contain the actual name of the Text Box control.

.
 
Further to this question posed here.... I have a list in a form or various contacts, they consist of Surname, forename, Tel No, Address etc. and each person record is listed horizontally. There are about 200 records in the form so obviously they disappear off the bottom of the form.

What I would like to do is, when the cursor is placed in any of the fields it highlights (in some fashion) the entire row showing that this person has been selected.

The reason is that I have many function button along the bottom of the from so it would be handy to highlight which field you are working with.

Thanks in advance...
 
Appreciate the response.

If I use continuous form I still have the same question.
How do a make the 'description' field be highlighted in a specific color when the 'Quantity Ordered" field has the focus?

hm. you may be able to setup your forms better, if i understand correctly what the "description" is for - is it to describe the item being ordered?

have a look the attached screen shots., where i can see the 'description' of the items as well as the order info at the same time:

attachment.php


attachment.php




i've made an order database for work, and i have a form with the item data displayed. on this main form, i have a subform that has all the ordering details for the item displayed.

if i want to view a different item, i choose one from the listbox on the left.

if i want to review orders on a particular date (or between dates) (which is sounding like what you are doing in your question?), i filter a query (via the "review orders" button you see in the first image, which calls the form in the second image) of all the orders and display who ordered what on which dates, the total amount for each order, and any orders pending or on back-order.... etc...
 

Attachments

  • items form.jpg
    items form.jpg
    90.1 KB · Views: 1,465
  • review orders filter form.jpg
    review orders filter form.jpg
    20.1 KB · Views: 1,307
  • rptOrders.pdf
    rptOrders.pdf
    51.3 KB · Views: 228

Users who are viewing this thread

Back
Top Bottom