linked tables update in before change

WilsonDC

Registered User.
Local time
Today, 04:40
Joined
Apr 16, 2012
Messages
11
I have a relationship between tblCustomers (pk) and tblCustomersSub (fk)

I have a StartTime field in table (tblCustomersSub) that has a lookup in "before changes" to set a field to yes or no that is in another table (tblCustomers)

I can get it to work so it looks up the date and sets the field but I want it do that for each individual record as it pertains to the relationship. Right now it looks up a date and sets the field to yes or no for every record.

macro is like this:

Look up a record in : tblCustomersSub
where condition = [tblCustomersSub].[Start Time] Like "2012-08*"
Alias:

If [tblCustomersSub].[Start Time] Like "2012-08*" Then
Setfield
Name: tblCustomers.August
Value= Yes

Else

Setfield
Name: tblCustomers.August
Value= No

End If
 
This usually happens in Continuous Forms... Try moving your Macro to Before_Update event and seeing if that works, though for this type of action one would normally use Conditional Formatting.
 
Quick question - are you working with a 2010 web database?
 
I apoligize for my absence, been busy with other jobs. Yes I use Access 2010. I am slowly learing about VBA but just not understanding the terminology yet so I try to use macros.

I will add the format to date and see how that helps.
 

Users who are viewing this thread

Back
Top Bottom