Back color in subform

Precips1

Registered User.
Local time
Today, 23:55
Joined
Dec 28, 2010
Messages
35
Hi -

Need some help - I have a subform called [Attendees Subform] which loads in a main form called [Attendees]

When the subform loads I have it set with a default view datasheet.
One of the fields within the subform is called [Indate] and would either contain the words "Live" or "Expired".

What I need to happen is - If the field = "Expired" then back color should equal Red. else white if it equals "Live"

I have a small routine which works fine for a report and works if I run this subform as a single form view apose to datasheet view.

If .Value = "Live" Then
.BackColor = vbWhite
.ForeColor = vbBlack
.FontBold = False
Else
.ForeColor = vbBlack
.BackColor = vbRed
.FontBold = True
End If

Anyone got idea why its going wrong?

Thanks in advance

Mike
 
If running in datasheet view you need to look into conditional formatting. In essence there is only one set of fields on the subform that is repeated for every record so its one for all and all for one.
 
I'll second that. You can do what you want with conditional formatting both in Datasheet view and in the regular form view. It's a better solution than using code unless code gives you some feature or benefit that conditional formatting cannot.

You'll basically create two conditions using "Field Value Is" "equal to". If you have any trouble with that you can use:
"Expression Is" [InDate] = Live

Be aware that you may need to use a single quote or double quotes around "Live" in your expression.
 
Ha! I have to laugh :) Never realised access had conditional formating.
Its all working fine - Thanks for the feedback - Its just about knowing where to look.

Nice website you have BTW - Hope you don't mind but I've saved your link as a favorite. Some nice top tips and templates. You don't happen to have a template for storing attachment files within access do you?

Best wishes

Mike
 
Are you referring to stroring attachments in fields as blobs or as attachment links?

Are you using A2007?
 
I'm using access 2003 - I'll be looking for some ideas for being able to save file attachments like word documents within access form - each page should show any files currently attached, different links for each form. Links can then be clicked on and open ups the file via hyper-link to the file.

Not sure how to explain...

Mike
 
Yes, you certainly can store links to files in Access and I've also had some success opening the files from Access as well. I recommend you open a new thread/post for this question.
 
If I have filed "A" (contain yes or NO) and want to change background color of any drawing object like rectangle, on YES condition. How can it be possible?

Note: I'm using split form!
 
If I have filed "A" (contain yes or NO) and want to change background color of any drawing object like rectangle, on YES condition. How can it be possible?

Note: I'm using split form!
For a rectangle object, if the form is Continuous or Datasheet then it can't be done. It's possible on a single form.

However, you can use a textbox to act like the rectangle then use Conditional Formatting on it.
 
Rectangle backcolor is changing on split form..its OK


I've another question!
I want to change rectangle backcolor on record navigation. which event should I have to use?
 
Last edited:
Rectangle backcolor is changing on split form..its OK


I've another question!
I want to change rectangle backcolor on record navigation. which event should I have to use?
 
see attachment first

I want to VISIBLE Rectangle when field "AVAILABLE" is checked (yes).

Note:This split form will be read only and use only for checking Documents status.

Please tell me how can it be possible.

Thanks for your previous reply too.
 

Attachments

Right, I will mention that for starters this is not your thread and you're asking a question that is completely different from the Original Post.

If you want to ask further questions, create a thread for that.

To answer your question, no it isn't possible in a split form, continuous view or datasheet view. But with conditional formatting you can make it look as if it is happening.
 
In the meantime, here's how you can use Conditional Formatting and a textbox to make it look visible/invisible.

Pay attention to the following properties of the textbox:

* Control Source
* Locked
* Tab Stop
* Border Style

Also take note of the code in the Enter event of the textbox.
 

Attachments

I have a sub form, which contain many fields beside field named [link];

I want to change the formating of record if the link filed is not empty.

for example, if field [link] contains some values then all record change to BOLT format else normal.

How can i make it possible....pls reply
 

Users who are viewing this thread

Back
Top Bottom