J
Jody
BACKGROUND:
I have a table (tblLogChange) whose purpose is to log the
primary key value and timestamp of changes made in another
table (tblProspSubscr). This is done with the following
code in the Form_AfterUpdate event of the form
(frmSubscriberMain) whose record source is a query based
on tblProspSubscr:
Dim StrSQL
StrSQL = "INSERT INTO tblLogChange(SubscriberID,
ChangedOn) SELECT " _
& Forms!frmSubscriberMain.ProspSubscrID & " AS
SubscriberID, Now() AS ChangedOn;"
DBEngine(0)(0).Execute StrSQL
The event code executes fine and the two fields are
consistently recorded in tblLogChange.
QUESTION:
I'd like to also record changes in tblLogChange made in a
table related to tblProspSubscr called tblLocation (where
one subscriber may have many locations.
The form whose record source is based on tblLocation is
called frmLocation and actually resides within a Page
(Tab) that sits on frmSubsriberMain.
I tried the same code in the Form_AfterUpdate in
frmLocation substituting only the form name:
Dim StrSQL
StrSQL = "INSERT INTO tblLogChange(SubscriberID,
ChangedOn) SELECT " _
& Forms!frmLocation.LocationID & " AS SubscriberID, Now()
AS ChangedOn;"
DBEngine(0)(0).Execute StrSQL
I get an error 2450 '....can't find frmLocation....'
I can't understand why the Forms!frmLocation.LocationID
doesn't work as it is contained within frmLocation.
Does it have something to do with the Page container or
some other reason that may be evident?
Any help is greatly appreciated.
Cheers,
Jody
I have a table (tblLogChange) whose purpose is to log the
primary key value and timestamp of changes made in another
table (tblProspSubscr). This is done with the following
code in the Form_AfterUpdate event of the form
(frmSubscriberMain) whose record source is a query based
on tblProspSubscr:
Dim StrSQL
StrSQL = "INSERT INTO tblLogChange(SubscriberID,
ChangedOn) SELECT " _
& Forms!frmSubscriberMain.ProspSubscrID & " AS
SubscriberID, Now() AS ChangedOn;"
DBEngine(0)(0).Execute StrSQL
The event code executes fine and the two fields are
consistently recorded in tblLogChange.
QUESTION:
I'd like to also record changes in tblLogChange made in a
table related to tblProspSubscr called tblLocation (where
one subscriber may have many locations.
The form whose record source is based on tblLocation is
called frmLocation and actually resides within a Page
(Tab) that sits on frmSubsriberMain.
I tried the same code in the Form_AfterUpdate in
frmLocation substituting only the form name:
Dim StrSQL
StrSQL = "INSERT INTO tblLogChange(SubscriberID,
ChangedOn) SELECT " _
& Forms!frmLocation.LocationID & " AS SubscriberID, Now()
AS ChangedOn;"
DBEngine(0)(0).Execute StrSQL
I get an error 2450 '....can't find frmLocation....'
I can't understand why the Forms!frmLocation.LocationID
doesn't work as it is contained within frmLocation.
Does it have something to do with the Page container or
some other reason that may be evident?
Any help is greatly appreciated.
Cheers,
Jody