Change Appearance of Form if Yes/No Field is Populated

Richie2837

Registered User.
Local time
Today, 18:47
Joined
Jan 30, 2007
Messages
88
Hi,

Our Contacts database holds records relating to individual clients. As these clients are visited in their homes, I have put a "Lone Worker Caution" yes/no field on the form to alert staff of potential risks prior to visiting. However, this doesn't offer enough of a visual signal to staff, so I would like to use some method of having a much more obvious visible signal being displayed if the "caution" check-box has been ticked - I thought a large red exclamation mark appearing on the form, or a change in colour to the forms' design but am open to other suggestions.

Does anyone know how to do this?

Thanks.
 
How about a flashing warning

and check the samples on how to do this
 
Is there a specific sample you know of?
 
Right my label202 is flashing

ok now what you need is if yes/no or tick box true then lalbel202.visble=true
else .... false
so if its true/yes/or 0 whatever code you have behind your tick box then this will flash a message

if its not ticked then its not visble (its still flashing but as its not visible you cannot see it)

this might not be the cleanest way of doing it but will work


Ok this should work on current formproperties you need


Me.TimerInterval = 300
Me.Label202.ForeColor = vbBlack
Me.TimerInterval = 300
Me.BusinessTxt.ForeColor = vbBlack


Private Sub Form_Timer()
With Me.Label202
.ForeColor = (IIf(.ForeColor = vbRed, vbBlack, vbRed))
End With
With Me.BusinessTxt
.ForeColor = (IIf(.ForeColor = vbRed, vbBlack, vbRed))
End With
End Sub
 
ignore
With Me.BusinessTxt
.ForeColor = (IIf(.ForeColor = vbRed, vbBlack, vbRed))
End With
i just cut and pasted the code (I have 2 bits flashing )
 
might be a bit confusing the way I have laid this out

so look at what I have psoted

but

make a label on your form

type in messgage
properties visible no

so when the form loads you cannot see it
however when you tick your box you need to change the propeties to visible

this bit should be quite easy

then look at the flash coding enter this in
 
Okay,

I've put a label on the screen with text "Lone Worker Warning", and set it's properties to be visible:no. On my Lone Worker Warning yes/no check box I've set the properties of on click: to be the event procedure: Private Sub LoneWorkerCaution__Click()
Label202.Visible = True
End Sub

Which makes the Label visible, but it does not disappear when I remove the tick from the yes/no box. What have I missed?
 
I've also noticed that even though I've ticked the check box against a single client, the Lone Worker Warning label becomes visible against every clients record.
 
I've also noticed that even though I've ticked the check box against a single client, the Lone Worker Warning label becomes visible against every clients record.
If you are using continuous forms that will be the case, so if I were you I wouldn't necessarily use the flashing method, but you can use CONDITIONAL FORMATTING. Select the control you want to format, click FORMAT > CONDITIONAL FORMATTING and set it that way. That will work in continous forms.
 
I will bow down to Bob exp -- I am just a hacker

- and yes sorry just look at my coding - it will flash all the time for all
oops

right what you need is if fieldname on table = true/yes/0 then lable.visible
else ......and you need this in a couple of places

on current on the form and after update on the tick box alos throw in a save and a refresh option

why 2 places when you open the form it looks at the code and see no not require (on a new record ) and you select it - this would not show unitl you reload the form by putting on the after update of the tickbox you are kinda making "live" refresh will check what you have done (soem go for reload form - I am not afan of this )

copy this onto the onload of the form as well
g
 
I'm trying to change the format of the yes/no check box, but "conditional Formatting" is greyed-out
 
If Me.Main_StatusDeclined = True Then

main is name of form
Statusdeclined is tickboxname and also fieldname on underlying table
Me.Label39.Visible = True


then the flashing code (this can sit anywhere as it is flashing all the time)
If Me.Main_StatusDeclined = False Then etc......

I have this on current on load and after update --I think I have this at least one 2 often but should work
 
I'm having real problems trying to implement this, I think I'm in way over my head with the VBA stuff, don't understand it at all and am just cutting and pasting. WOuld anyone be willing to have a look?
 
look at the attached
and all of the coding - not the tidest bit of coding doing this on the fly

but once the tick has been tick you see it flash - if its not ticked you don't see it
 

Attachments

you could acutal change the whole colour of the form to say red

Play with the form on click ... me.form.colour etc

once you understanding this concept you can have also sort of things going on ,

on my project I have a declined ticked once declined then the details grey out another one is accepted and it hides the declined option - (You cannot be accepted and declined at the same time)

the problem with this is Access Colour pallet is not really ....


Grey fine other colours look well naff maybe 07 will be better- but 07 seems to be having some glitches in it - my next upgrade will be to 2003 (If i do one)

G
 
Refer to my zip file
this will turn the whole form red if true and grey if false


If Me.Fistyn = True Then
Me.Detail.BackColor = 255
End If
If Me.Fistyn = False Then
Me.Detail.BackColor = -2147483633
End If


does depend on how visual you want -

(Looks awful) stick with the flashing message looks nicer(?)
 
Thanks, but I'm still having problems. I have Label202 on the form set to visible:no. I have a yes/no check-box with the following code:

Private Sub LoneWorkerCaution__AfterUpdate()
If Me.LoneWorkerCaution = True Then
Me.Label202.Visible = True
End If
If Me.LoneWorkerCaution = False Then
Me.Label202.Visible = False

End If

End Sub

Private Sub Form_Contacts()

If Me.LoneWorkerCaution = True Then
Me.Label202.Visible = True
End If
If Me.LoneWorkerCaution = False Then
Me.Label202.Visible = False
End If
Me.TimerInterval = 300
Me.Label202.ForeColor = vbBlack



End Sub

Private Sub Form_Timer()
With Me.Label202
.ForeColor = (IIf(.ForeColor = vbRed, vbBlack, vbRed))
End With


End Sub

Everytime I click the yes/no check box to activate the warning message, VBA opens up with the message "Compile Error: Method or Data Member Not Found".

What does this message mean? As I've copied your code direct from the Flash db and only amended the relevant names, I don't understand why it isn't working.

Aargh!
 
unable to open d/base


right --- on the timer properties of your form (4 th option form bottom) put

With Me.Label202
.ForeColor = (IIf(.ForeColor = vbRed, vbBlack, vbRed))
End With


on the on current properties put

If Me.LoneWorkerCaution= True Then
Me.Label202.Visible = True
End If
If Me.LoneWorkerCaution= False Then
Me.Label202.Visible = False
End If
Me.TimerInterval = 300
Me.Label202.ForeColor = vbBlack


and on the after update of your tick box loneworkercaution
If Me.LoneWorkerCaution= True Then
Me.Label202.Visible = True
End If
If Me.LoneWorkerCaution= False Then
Me.Label202.Visible = False
End If
 

Users who are viewing this thread

Back
Top Bottom