G
Guest
Good day
My database deals with subscribers to a service. The database, which is in operation, cannot have its table/relationship structure modified, and has a one-to-many relationship between subscribers and locations. Each subscriber may have many locations, a location belongs to a single subscriber. This is implemented with tblSubscriber (PrimaryK-ProspSubscrID) related to tlbLocation (PrimaryK-LocationID, ForeignK-ProspSubscrID)
I'd like to occasionaly create a duplicate record (all but the autonumber primary key) in tblLocation for a co-subscriber. Currently, the end user first enters subscriber 1 data (in the main form) and then enters a location manually, related to subscriber 1 (in the subform). After saving subscriber 1 data, the end user enters subscriber 2 data (in the main form) and I would like my application to TRIGGER THE SAME LOCATION data to be populated automatically for subscriber 2 (which would show automatically in the subform). As I mentioned above, it is too late to modify the table/relationship structure - so that is why I would like to duplicate a record occasionally
One of the fields in tblSubscriber is CoSubscriberID which has a functioning look-up relationship with an alias of tbllSubscriber. CoSubscriberID is shown on the main form as a combo with ProspSubcrID bound in the embedded SQL statement. I'm thinking of having that selected value (ProspSubscrID) trigger an update query programmatically. After searching previous newsgroup messages I found similar issues and came up with the following code to fit my situation. It does NOT cause an error, but also does not duplicate the record in the location table (the desired effect). Can you shed some light on this perhaps
Private Sub CoSubscriberID_AfterUpdate(
Dim sSQL As Strin
'Duplicate the related record
sSQL = "INSERT INTO tblLocation (Street1, SatelliteID, LocnTypeID, ProspSubscrID)" &
" " & "SELECT tblLocation.Street1, tblLocation.SatelliteID, tblLocation.LocnTypeID, tblLocation.ProspSubscrID" &
" " & "FROM tblLocation" & " " &
"WHERE (tblLocation.ProspSubscrID = " & Me.ProspSubscrID & ");
DBEngine(0)(0).Execute sSQ
End Su
Thanks very much for your help.
My database deals with subscribers to a service. The database, which is in operation, cannot have its table/relationship structure modified, and has a one-to-many relationship between subscribers and locations. Each subscriber may have many locations, a location belongs to a single subscriber. This is implemented with tblSubscriber (PrimaryK-ProspSubscrID) related to tlbLocation (PrimaryK-LocationID, ForeignK-ProspSubscrID)
I'd like to occasionaly create a duplicate record (all but the autonumber primary key) in tblLocation for a co-subscriber. Currently, the end user first enters subscriber 1 data (in the main form) and then enters a location manually, related to subscriber 1 (in the subform). After saving subscriber 1 data, the end user enters subscriber 2 data (in the main form) and I would like my application to TRIGGER THE SAME LOCATION data to be populated automatically for subscriber 2 (which would show automatically in the subform). As I mentioned above, it is too late to modify the table/relationship structure - so that is why I would like to duplicate a record occasionally
One of the fields in tblSubscriber is CoSubscriberID which has a functioning look-up relationship with an alias of tbllSubscriber. CoSubscriberID is shown on the main form as a combo with ProspSubcrID bound in the embedded SQL statement. I'm thinking of having that selected value (ProspSubscrID) trigger an update query programmatically. After searching previous newsgroup messages I found similar issues and came up with the following code to fit my situation. It does NOT cause an error, but also does not duplicate the record in the location table (the desired effect). Can you shed some light on this perhaps
Private Sub CoSubscriberID_AfterUpdate(
Dim sSQL As Strin
'Duplicate the related record
sSQL = "INSERT INTO tblLocation (Street1, SatelliteID, LocnTypeID, ProspSubscrID)" &
" " & "SELECT tblLocation.Street1, tblLocation.SatelliteID, tblLocation.LocnTypeID, tblLocation.ProspSubscrID" &
" " & "FROM tblLocation" & " " &
"WHERE (tblLocation.ProspSubscrID = " & Me.ProspSubscrID & ");
DBEngine(0)(0).Execute sSQ
End Su
Thanks very much for your help.