After Update change Does not work??????

Liz_I3

Well-known Member
Joined
Dec 30, 2002
Messages
647
Office Version
  1. 2016
Platform
  1. Windows
I am working with Access 2000 , a main form "Input" with a subform "Transaction subform"

If I manully change the "biweeklydate" field on the subform my below code works perfectly.


This is on the After Update property of the sub form
Private Sub BiWeeklyDate_AfterUpdate()
DoCmd.RunMacro "weekdays"
If Forms![Input]![transaction subform]![Frequency] = "Daily" And Forms![Input]![transaction subform]![days of the week] = "Saturday" Then
Forms![Input]![transaction subform]![BiWeeklyDate] = DateAdd("d", 2, [BiWeeklyDate])
ElseIf Forms![Input]![transaction subform]![Frequency] = "Daily" And Forms![Input]![transaction subform]![days of the week] = "Sunday" Then
Forms![Input]![transaction subform]![BiWeeklyDate] = DateAdd("d", 1, [BiWeeklyDate])
ElseIf Forms![Input]![transaction subform]![Frequency] = "Other" And Forms![Input]![transaction subform]![days of the week] = "Saturday" Then
Forms![Input]![transaction subform]![BiWeeklyDate] = DateAdd("d", 2, [BiWeeklyDate])
ElseIf Forms![Input]![transaction subform]![Frequency] = "Other" And Forms![Input]![transaction subform]![days of the week] = "Sunday" Then
Forms![Input]![transaction subform]![BiWeeklyDate] = DateAdd("d", 1, [BiWeeklyDate])
End If
DoCmd.RunMacro "weekdays"
End Sub


However when the same field "biweeklydate" is change with the below code the above code does not work or is not activated

I did try placing the above code on the Change propery but will no effect.

This code is on the on Activate property of the sub form
Private Sub Form_Activate()

Do Until [CLIENTID] = "0"

'If Text104.Value = Forms![Input]![ActiveXCtl61].Value Then
'BiWeeklyDate.Value = Forms![Input]![ActiveXCtl61].Value
If Text104.Value <= Forms![Input]![ActiveXCtl61].Value And Forms![Input]![ActiveXCtl61].Value <= Date Then
BiWeeklyDate.Value = Text104.Value

End If
DoCmd.GoToRecord acDataForm, "TRANSACTION Subform", acNext, 1

Loop
End Sub

I have been tring to get this to work for 2 days now with no luck ANY help would be very welcome

Thanks
Liz :oops:
Code:
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Try this instead.

Yank the code out of the form completely and throw it into a general purpose code module. I didn't check closely but it appears you're doing the long version of control referencing (which is exactly what you have to do in a general module).

You can then have multiple events call the same code.

Only trap is that you must make sure the form is open when you execute the code or it'll error out on you.

Mike
 
Upvote 0
Just as information, when I said you were doing long referencing, what I mean is this.

When you're on a given form, this will get the controls on the form.

Me.controlname

Add .propertyname as needed.

www.accessweb.com has a great example for referencing on it.

Mike
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,252
Members
451,757
Latest member
iours

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top