AfterUpdate

Hello Chaps,

In the AfterUpdate code I had the detail back colour change if a check box 
(tbc) = True. However if I tick the box now it turns the back colour of every 
form irrespective if that record is ticked tbc or not! 

Any help on solving this would be great.

JAMES


Private Sub tbc_afterupdate()

If Me.tbc = True Then
Me.Section(0).BackColor = 65535
Else
Me.Section(0).BackColor = 16777215
End If
End Sub

0
Utf
1/31/2008 3:46:03 PM
access.forms 6864 articles. 2 followers. Follow

5 Replies
644 Views

Similar Articles

[PageSpeed] 51

If you are using a continuous form, that code won't work. The good news is 
that you can use Conditional Formatting to make it work. In Design View, 
select the combo box and from the menu, choose Format >>> Conditional 
Formatting, then set your conditions.
-- 
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"James Frater" <JamesFrater@discussions.microsoft.com> wrote in message 
news:D9ECCB6C-DA20-4C7D-8EE1-1AD4F735A609@microsoft.com...
> Hello Chaps,
>
> In the AfterUpdate code I had the detail back colour change if a check box
> (tbc) = True. However if I tick the box now it turns the back colour of 
> every
> form irrespective if that record is ticked tbc or not!
>
> Any help on solving this would be great.
>
> JAMES
>
>
> Private Sub tbc_afterupdate()
>
> If Me.tbc = True Then
> Me.Section(0).BackColor = 65535
> Else
> Me.Section(0).BackColor = 16777215
> End If
> End Sub
> 


0
Arvin
1/31/2008 5:15:34 PM
Arvin,

I'm using a good old fashioned single form, and apologies for not making it 
clearer it's a yes/no box rather than a combo box that I'm using, so 
conditional formatting doesn't work.

I've tried setting the reverse conditions in the beforeupdate event but 
still can't it to work.

Any futher suggestions would be most welcome.

Regards

JAMES


"Arvin Meyer [MVP]" wrote:

> If you are using a continuous form, that code won't work. The good news is 
> that you can use Conditional Formatting to make it work. In Design View, 
> select the combo box and from the menu, choose Format >>> Conditional 
> Formatting, then set your conditions.
> -- 
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
> 
> "James Frater" <JamesFrater@discussions.microsoft.com> wrote in message 
> news:D9ECCB6C-DA20-4C7D-8EE1-1AD4F735A609@microsoft.com...
> > Hello Chaps,
> >
> > In the AfterUpdate code I had the detail back colour change if a check box
> > (tbc) = True. However if I tick the box now it turns the back colour of 
> > every
> > form irrespective if that record is ticked tbc or not!
> >
> > Any help on solving this would be great.
> >
> > JAMES
> >
> >
> > Private Sub tbc_afterupdate()
> >
> > If Me.tbc = True Then
> > Me.Section(0).BackColor = 65535
> > Else
> > Me.Section(0).BackColor = 16777215
> > End If
> > End Sub
> > 
> 
> 
> 
0
Utf
2/5/2008 3:29:05 PM
Hi - 

The True/Dalse check for tbc_ is only done if you make a change to the tbc_
checkbox by clicking on it.

Try putting your code in the On current event of the form as well, so that it
runs each time you move to a new record.

John

James Frater wrote:
>Arvin,
>
>I'm using a good old fashioned single form, and apologies for not making it 
>clearer it's a yes/no box rather than a combo box that I'm using, so 
>conditional formatting doesn't work.
>
>I've tried setting the reverse conditions in the beforeupdate event but 
>still can't it to work.
>
>Any futher suggestions would be most welcome.
>
>Regards
>
>JAMES
>
>> If you are using a continuous form, that code won't work. The good news is 
>> that you can use Conditional Formatting to make it work. In Design View, 
>[quoted text clipped - 19 lines]
>> > End If
>> > End Sub

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200802/1

0
J_Goddard
2/5/2008 3:41:47 PM
Sure conditional formatting works. In Design View:

1. Select the textbox that you want the backcolor to change
2. Go to Format >>> Conditional Formatting
3. In the Condition 1 combo, change to read "Expression is"
4. Enter: [NameOfCheckbox]= -1
5. Pick the color in the fill condition.
6. Click OK
-- 
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"James Frater" <JamesFrater@discussions.microsoft.com> wrote in message 
news:DA5A468A-EB7B-4E01-900F-1AA655A13C2F@microsoft.com...
> Arvin,
>
> I'm using a good old fashioned single form, and apologies for not making 
> it
> clearer it's a yes/no box rather than a combo box that I'm using, so
> conditional formatting doesn't work.
>
> I've tried setting the reverse conditions in the beforeupdate event but
> still can't it to work.
>
> Any futher suggestions would be most welcome.
>
> Regards
>
> JAMES
>
>
> "Arvin Meyer [MVP]" wrote:
>
>> If you are using a continuous form, that code won't work. The good news 
>> is
>> that you can use Conditional Formatting to make it work. In Design View,
>> select the combo box and from the menu, choose Format >>> Conditional
>> Formatting, then set your conditions.
>> -- 
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.mvps.org/access
>> http://www.accessmvp.com
>>
>> "James Frater" <JamesFrater@discussions.microsoft.com> wrote in message
>> news:D9ECCB6C-DA20-4C7D-8EE1-1AD4F735A609@microsoft.com...
>> > Hello Chaps,
>> >
>> > In the AfterUpdate code I had the detail back colour change if a check 
>> > box
>> > (tbc) = True. However if I tick the box now it turns the back colour of
>> > every
>> > form irrespective if that record is ticked tbc or not!
>> >
>> > Any help on solving this would be great.
>> >
>> > JAMES
>> >
>> >
>> > Private Sub tbc_afterupdate()
>> >
>> > If Me.tbc = True Then
>> > Me.Section(0).BackColor = 65535
>> > Else
>> > Me.Section(0).BackColor = 16777215
>> > End If
>> > End Sub
>> >
>>
>>
>> 


0
Arvin
2/5/2008 4:16:29 PM
John,

It works!

Thanks for this most appreciated.

Regards

JAMES

"J_Goddard via AccessMonster.com" wrote:

> Hi - 
> 
> The True/Dalse check for tbc_ is only done if you make a change to the tbc_
> checkbox by clicking on it.
> 
> Try putting your code in the On current event of the form as well, so that it
> runs each time you move to a new record.
> 
> John
> 
> James Frater wrote:
> >Arvin,
> >
> >I'm using a good old fashioned single form, and apologies for not making it 
> >clearer it's a yes/no box rather than a combo box that I'm using, so 
> >conditional formatting doesn't work.
> >
> >I've tried setting the reverse conditions in the beforeupdate event but 
> >still can't it to work.
> >
> >Any futher suggestions would be most welcome.
> >
> >Regards
> >
> >JAMES
> >
> >> If you are using a continuous form, that code won't work. The good news is 
> >> that you can use Conditional Formatting to make it work. In Design View, 
> >[quoted text clipped - 19 lines]
> >> > End If
> >> > End Sub
> 
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200802/1
> 
> 
0
Utf
2/5/2008 4:22:04 PM
Reply:

Similar Artilces:

AfterUpdate/BeforeUpdate and SetFocus
I have some problems with the SetFocus command in a Userform with an AfterUpdate or BeforeUpdate routine. To make it clear to you, I made a very small Userform to demonstrate it. It only contains 8 TextBoxes and this code: Code: Private Sub TextBox01_AfterUpdate() Me.TextBox08.SetFocus End Sub - Private Sub TextBox02_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean) TextBox08.SetFocus End Sub - Private Sub TextBox03_Exit(ByVal Cancel As MSForms.ReturnBoolean) TextBox08.SetFocus End Sub - Private Sub TextBox04_Change() TextBox08.SetFocus End Sub I expected that in ...

AfterUpdate
Hello Chaps, In the AfterUpdate code I had the detail back colour change if a check box (tbc) = True. However if I tick the box now it turns the back colour of every form irrespective if that record is ticked tbc or not! Any help on solving this would be great. JAMES Private Sub tbc_afterupdate() If Me.tbc = True Then Me.Section(0).BackColor = 65535 Else Me.Section(0).BackColor = 16777215 End If End Sub If you are using a continuous form, that code won't work. The good news is that you can use Conditional Formatting to make it work. In Design View, select the combo box and fro...

AfterUpdate Question!
I want to add this to my code , Ony enter date if [DateCheck] (checkbox) is -1 Any help would be great..............Thanks Bob Private Sub tbAdditionCharge_AfterUpdate() If tbDayNo.value = "" Or IsNull(tbDayNo.value) Then tbDayNo.value = Format(Now, "dd-mmm-yy") End If End Sub Hi Bob, Me.tbDayNo=IIf(Me.DateCheck And IsNull(tbDayNo), _ Format(Date,"dd/mm/yy"),tbDayNo) Regards Jacob "Bob V" <rjvance@ihug.co.nz> wrote in message news:%23xApdzD7HHA.4880@TK2MSFTNGP03.phx.gbl... | | I want to add this to my code , Ony enter date if [D...

BeforeUpdate or AfterUpdate ?
Hi all, I have an unbound form in which I have (amongst others) two comboboxes with mandatory data. Although I present a combobox, limited to the choices to pick out, people manage not to fill in those data and to jump via the TAB-key to the next field. Of course I’ll have NULL value for this combobox, but how can I force the user to look for the correct row ? In the BeforeUpdate or in the AfterUpdate event ? I have some code like : Private Sub CboAfterUpdate() if isnull(me.Cbo) then Beep Msgbox(“You must choose a value”) Me.cboAfter.setfocus endif end sub But this does not se...

AfterUpdate Problem
I need to flash an "RE-ORDER ALERT" message after inventory level falls below re-order level. The message only flashes up when I move to a next record and back after a DoCmd.Save. I need the message to flash immediate after a Save. Note. The message is a flashing label on the form. Thank you. Perhaps you could code it to actually flash before DoCmd.Save is processed. Once you're into that code string, it will be run. Or, maybe consider a Message Box. I like this idea because it forces the user to interact with the reorder message. No one can say "I didn'...

AfterUpdate VB If statement
I am having a problem with this code: Private Sub Cart_Shed_Number_AfterUpdate() If (Me.Cart_Shed_Number) = "NA" And (Me.Cart_Type) = "NA" Then Me.Cart_Shed_Fee = "0" ElseIf (Me.Cart_Shed_Number) >= "A" And (Me.Cart_Type) = "Gas" Then Me.Cart_Shed_Fee = "10" ElseIf (Me.Cart_Shed_Number) >= "A" And (Me.Cart_Type) = "Electric" Then Me.Cart_Shed_Fee = "20" End If End Sub I want it to auto populate a "cart shed fee" field on a form depending on the answers to the &q...

Unbound combobox AfterUpdate
Hi On some form I have several unbound combobox controls. Whenever some of them is changed, I want: 1. reset the values for other combos on same form; 2. reset Filter and FilterOn properties for subform on same form; 3. reset Rowsource for a record locating combobox on this subform. Currently I use combo's AfterUpdate's events for this - like here: Private Sub Combo1_AfterUpdate() Me.Combo2 = 0 Me.Combo3 = 0 If Nz(Me.Combo1, 0) = 0 Then Me.MySubform.Form.Filter = "" Me.MySubform.Form.FilterOn = False ...

AfterUpdate Requery
I'm having a problem with Requery. I have 7 combo boxes that are cascading. One gets it's data from the previous one. The first three requery and blank out the combo boxes if the item that was selected isn't in the new list. Although the last four do requery and get a new list, they keep the previous selected text even if it isn't in the new list. I set the Limit To List option but that didn't have an effect on the last four combo boxes. I posted the different ways I've tried requerying below. The only one that seems to remove the data is DoCmd.Requery but on...

blinking form afterupdate
Hi, When i use this command: DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70 The form blinks with every update. Is there a way to prevent the form from blinking ? I hope to hear from you ! Best regards and thanks in advance, Pierre This code requeries the form and displays any changes to the data. Where are you using that code - is it on a button or some other event? Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia "Pierkes" <info@advisearch.nl> wrote in message news:4bf61674$0$31931$703f8584@news.kpn.nl... > Hi...

AfterUpdate Form Event Fires Repeatedly
I've been having this problem for a few months with a db I'm working on. I know there must be something simple I'm overlooking, so I'd greatly appreciate any help in identifying what the problem is. I'm using the following to create a timestamp: Me.dbLastUpdateUser = Forms!frmUserInfoHIDDEN!txtUserName Me.dbLastUpdate = Now() frmuserInfoHIDDEN refers to a form that is hidden on startup that stores the name the user logged in with. This feature works fine. The AfterUpdate timestamp used to work as well. However, now it repeatedly fires and forces the user to stay on ...

Triggering AfterUpdate Event
I have a data entry form using forms and multipages with numerous dat fields for the user to populate. I have also written error handlers t restrict the input of the user using the AfterUpdate event (e.g. I they enter an invalid entry for a date field and move off, th AfterUpdate triggers an error message, which pops up next to th field). The general usage of this is that someone will open a new form, ente data, and write to a worksheet. Since I do not allow invalid data to b written, I can ensure that the data is correct when it is written, s when I open the form, I do not need to validate ...

Repeat afterupdate code
Hello, I have a form that has about 25 inputs for data. I then have about 15 boxes that I just calculate some numbers so people can see what the effects are as they enter it. So for every data entry point I have the code behind AfterUpdate calling Private Sub Start_number_AfterUpdate() Call Calculations End Sub Private sub Calculations() ..... End sub Is there a way to have the calculation boxes all update after any of the data entry points have without have to put in the afterupdate behind each one? It works fine the way it is right now but I would like to clean it ...

AfterUpdate event procedure
I have an AfterUpdate procedure that populates values from a subform into fields on my main data entry form. The forms/subforms were created using Access 2000 and worked correctly in Access 2003. When I upgraded to Access 2007, the code no longer works....unless I enter the STUDYID value twice. Any ideas as to why this is occurring? And how do I fix it? Private Sub STUDYID_AfterUpdate() [LNAME] = [frmsubIsol07].Form![Lname2] [MI] = [frmsubIsol07].Form![MI2] [FNAME] = [frmsubIsol07].Form![Fname2] [COUNTY] = [frmsubIsol07].Form![County2] [HOSPID] = [frmsubIsol07].Form![Ho...

AfterUpdate Now() to table
I am using: CurrentDb.Execute "UPDATE tbl_Projects SET DateUpdated = Now()" as suggested here, but it is updating ALL records, how do I specify the record that was actully changed? If you are talking about TimeStamping a record that was updated on a form then you want your code in the BeforeUpdate event of the form. In this case you do not need SQL but simply: [DateUpdated] = Now MeSteve wrote: >I am using: >CurrentDb.Execute "UPDATE tbl_Projects SET DateUpdated = Now()" >as suggested here, but it is updating ALL records, how do I specify the >record that w...

AfterUpdate Event for TextBox
I have this code for the afterupdate event on a text box that has data in it. Me.Text732 = Replace(Abs(Val([Text732])), ".", "") When I past this data 0000272400123456 into the text box, it gets rid of the 0000, becomes 272400123456 But if I past this kind of number 4223697600059898, it turns it into this 42236976000599E+15 If I take the coding away and past the 4223697600059898 number, it stays the same and doesn't get changed to the +15. Any suggestions or changes to code to fix this? Thanks! Curtis if its a text field then it shouldnt be modifying any v...

Checkbox Click (and Afterupdate?)
I have a form with multiple checkboxes in the following format: _X_ Northeast _X_ New England _X_ State1 _X_ State2 ... _X_ Mid Atlantic _X_ State5 _X_ State6 ... Using the following code in the On Click Event I was able to select all the states in each row (i.e. all the states in New England): If (Me."New England") Then Me.State1 = True Me.State2 = True ... Else Me.State1 = False Me.State2 = False ... End If I thought that if I were to apply the same principle to the "Northeast" checkbox...: If (Me."Northeast") Then Me."New Engla...

AfterUpdate event not firing?
I have a form which opens up a subform. On subform, there is a tab control which has five tabs on it. Each tab contains a sub-form on it. I have a combo box on one of these sub-forms to which I am attempting to add in functionality to implement a recent entries list. I have the following code added to this sub-form's control's AfterUpdate event. However, this event does not fire after the field is updated. I have verified this by inserting breakpoints in the code, and the breakpoint never fires either. Any idea why the AfterUpdate event is not firing? Any input would be great. Thanks...

Afterupdate Code Question
I am using the following code to disable the date field if the yes/no box is null or false: Private Sub Combo33_AfterUpdate() Me.Ctl1st_Date.Enabled = Nz(Me.Combo33, False) Me.Most_Recent_Date.Enabled = Nz(Me.Combo33, False) End Sub What can i place in this code so that it also deletes whatever date was in this field if it is selected as N or False? Any help is appreciated. Do I also need to place this in the beforeupdate of the form? Nevermind I just added: If Me.Combo33 = False Then Me.Ctl1st_Date = Null Me.Most_Recent_Date = Null And it works fine ? ...

Listbox will not Requery AfterUpdate
I am running Access 2007. I have two listboxes sitting side by side on the same form. One has phone number categories - lstCategories The second listbox has name, phone numbers - lstPhoneNumbers Both listboxes are unbound I had this working once where you could click the category in the first box and it would filter the second listbox to the phone number in a different category. Example: click category box select family, friend etc. the second box would only show numbers of family or category you selected in the first box. Now, the boxes work perfectly fine as far ...

Date picker and afterupdate event
I have many date controls on different forms in different Access 2007 projects. At least 2 of them have afterupdate events and it seems as if Access now triggers an afterupdate event when the date control is entered/receives focus. If you examine the date in the event sub you find that the oldvalue and value properties are identical. I can write code to get around this problem but I think this is an access bug associated with date picker. I'm pretty sure there is another bug associated with the date picker too, but a previous post regarding that fault did not get any replies. Has ...

Auto filling Form AfterUpdate question
I have a database for a reference in my office's library. It has a table with the following fields: Title: title of the book FirstName: of author LastName: of author PID: Letter code pertaining to subject matter (i.e. W for wildlife) BID: autonumber key for database AuthorID: Initials of the author which is what im trying to autofill in my form ok so my problem is I want someone to be able to enter the first name and last name in the form and have the AuthorID automatically put the initials in. Can anyone help me? I have some very limited VBA experience and would really appreciate any h...

Trying to check what exaclty changed AfterUpdate/BeforeUpdate
I'm working on an employee database, and need to have it send an e- mail if certain items change (name & address). The e-mail part works, but checking to see what in the record changed using AfterUpdate doesn't seem to. Private Sub Form_AfterUpdate() If "Me!Address" <> "Tables![Addresses]![Address]" Then Dim intAnswer As Integer intAnswer = MsgBox("You have made changes this employees personnel file. Would you like to send changes to the appropriate parties?", vbQuestion + vbYesNo, "Changes Detected") If intAnswer = vbYes...

AfterUpdate code to validate check boxes
To be eligible for a study, a patient has to meet certain criteria. There are 7 things that could prevent the patient from being eligible (e.g., "Patient is ill," "Patient is pregnant," "Patient is on medication," etc.). On a form, these 7 criteria are listed as 7 check boxes (Yes/No fields). The nurse is asked to "check all that apply." If at least one of the 7 boxes is checked, a text box says, "Patient is NOT eligible." If none of the 7 boxes is checked, the text box says, "Patient IS eligible" One way to code this is to create a...

Conversion difficulty with AfterUpdate code on combo
I am enquiring if there is a defect in the procedure for converting MSAccess97 developed applications to MSAccess2000. In two different cases I have found that the Afterupdate line:- DoCmd.ApplyFilter , "[Student]![StudentID]=Forms! [frmEntry]![Find a Student]" or similar, to select a particular record from a combo does not work the same in Access2000 as in Access97. While there might be a new record selected after every afterUpdate event in Access97, in Access2000 it only works the first time it is used or after the forn is re activated(?). Is there a fix for this? Or do...

Problem trying to trap error in AfterUpdate event
I'm having a problem with trying to trap an error on a form that I've created. I"m a "code newbie", so please keep that in mind. Here's some background: The database will contain records of certain diseases. The data will be entered by county nurses, but before they enter all the data, I'd like to check to make sure the data hasn't been entered already (sometimes there are duplicates of the paperwork floating around). We tried putting a big "Save Record" button on the form, but they were tabbing past it Once they enter the info that goes i...