Connecting Tech Pros Worldwide Forums | Help | Site Map

DAO seems to be updating more than current record???

MLH
Guest
 
Posts: n/a
#1: May 7 '07
I have a query that I open the following way...
Dim MyDB As Database, MyRst As Recordset
Set MyDB = CurrentDb
Set MyRst = MyDB.OpenRecordset("qryUnpaidInvoices", dbOpenDynaset)
MyRst.MoveFirst
Need2Send = False
InvoiceDate = MyRst!InvoiceTDstamp
LastSendDate = MyRst!LastReminderDate
If DateDiff("d", LastSendDate, Now) >= 3 Then
MyRst.Edit
MyRst!LastReminderDate = Now
MyRst.Update
Need2Send = True
End If
The query rreturns 2 records. When the recordset Update executes,
it seems that both of thsoe records are being updated instead of just
the current record in DAO. I only want the first of the 2 records to
receive the new setting of Now(). Am I missing something here, or is
this strange behavior?

Here's the query...
SELECT tblVehicleJobs.InvoiceNumber, tblVehicleJobs.ProcFee,
tblinvoiceNums.InvoiceTDstamp, tblClusters.ClusterName, [VColor] & " "
& [VehicleYear] & " " & [VehicleMake] & " VIN: " & [SerialNum] & " at
" & [TowCompany] & " " & [TowCoAddr] & " " & [TowCoCity] & " VID: "
& CStr([VehicleJobID]) & " Sale Date Scheduled: " & [SaleDate] AS
Vehicle, tblinvoiceNums.LastReminderDate, tblClusters.ClusterID,
tblVehicleJobs.VehicleJobID, tblClusters.PCeMail, tblClusters.BCeMail,
SaleDate4Avehicle([VehicleJobID]) AS SaleDate
FROM tblClusters INNER JOIN (tblAdmin INNER JOIN (tblinvoiceNums INNER
JOIN tblVehicleJobs ON tblinvoiceNums.InvoiceNumber =
tblVehicleJobs.InvoiceNumber) ON tblAdmin.TowCoID =
tblVehicleJobs.TowCoID) ON tblClusters.ClusterID = tblAdmin.ClusterID
WHERE (((tblVehicleJobs.InvoiceNumber) Is Not Null) AND
((tblVehicleJobs.InvoicePaid)=False));



MLH
Guest
 
Posts: n/a
#2: May 7 '07

re: DAO seems to be updating more than current record???


Oops... my bad.

I see that updating the SINGLE record in tblinvoiceNums
reflects for both cars in tblVehicleJobs because those two
tables are related on the [InvoiceNumber] field. Of course,
any setting made in tblinvoiceNumswould apply to all cars
in tblVehicleJobs billed under the same invoice.
Closed Thread