Back color in subform (1 Viewer)

Precips1

Registered User.
Local time
Today, 08:28
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
 

DCrake

Remembered
Local time
Today, 08:28
Joined
Jun 8, 2005
Messages
8,632
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.
 

hk1

Registered User.
Local time
Today, 01:28
Joined
Sep 1, 2009
Messages
121
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.
 

Precips1

Registered User.
Local time
Today, 08:28
Joined
Dec 28, 2010
Messages
35
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
 

DCrake

Remembered
Local time
Today, 08:28
Joined
Jun 8, 2005
Messages
8,632
Are you referring to stroring attachments in fields as blobs or as attachment links?

Are you using A2007?
 

Precips1

Registered User.
Local time
Today, 08:28
Joined
Dec 28, 2010
Messages
35
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
 

hk1

Registered User.
Local time
Today, 01:28
Joined
Sep 1, 2009
Messages
121
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.
 

asad.saeed

Sharp Killer
Local time
Today, 11:28
Joined
Nov 28, 2008
Messages
30
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!
 

vbaInet

AWF VIP
Local time
Today, 08:28
Joined
Jan 22, 2010
Messages
26,374
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.
 

asad.saeed

Sharp Killer
Local time
Today, 11:28
Joined
Nov 28, 2008
Messages
30
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:

vbaInet

AWF VIP
Local time
Today, 08:28
Joined
Jan 22, 2010
Messages
26,374
I don't understand. Try and explain it another way.
 

asad.saeed

Sharp Killer
Local time
Today, 11:28
Joined
Nov 28, 2008
Messages
30
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?
 

asad.saeed

Sharp Killer
Local time
Today, 11:28
Joined
Nov 28, 2008
Messages
30
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

  • sample.zip
    67.9 KB · Views: 94

vbaInet

AWF VIP
Local time
Today, 08:28
Joined
Jan 22, 2010
Messages
26,374
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.
 

vbaInet

AWF VIP
Local time
Today, 08:28
Joined
Jan 22, 2010
Messages
26,374
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

  • SampleVisible.mdb
    328 KB · Views: 85

asad.saeed

Sharp Killer
Local time
Today, 11:28
Joined
Nov 28, 2008
Messages
30
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

Top Bottom