No-one can really answer this, unless you tell us what is the Primary Key of
each table.
If you do not know what a Primary Key is, you have some study to do, before
you do more coding. Maybe start here:
http://support.microsoft.com/support...es/Q100139.ASP
HTH,
TC
"Linda" <(E-Mail Removed)> wrote in message
news:07a401c42529$1d99c4c0$(E-Mail Removed)...
> I have the following routine:
>
> Set rstin = dbs.OpenRecordset("Select * From
> detailsmobile Where CallDate Between #" & varDateBeg & "#
> And #" & varDateEnd & "#")
> Set rstsplit = dbs.OpenRecordset("tblTenants")
> Set rstout = dbs.OpenRecordset("tblresult")
>
> Note: vardatebeg contains the value #01/01/2004#
> and vardateend contains the value #02/01/2004#
>
> tbltenants contains the Telephonenrs and the startdates
> and the enddates.
>
> rstsplit.MoveFirst
> Do Until rstsplit.EOF
>
> If rstsplit!EndDate >= varDateBeg And rstsplit!EndDate <=
> varDateEnd Then
>
> searchnumber = rstsplit!TelephoneNumber
> FindFirst "CallingNumber='" & searchnumber & "'"
> If rstin.NoMatch Then
> rstin.Edit
> Else
> rstout.AddNew
> rstout!TelephoneNumber = rstin!CallingNumber
> rstout!OccupantID = rstsplit!OccupantID
> rstout.Update
> End If
> End If
> rstsplit.MoveNext
> Loop
>
> what I want to do here is that when the end date from
> tbltenants fall with the period of vardatebeg and
> enddatebeg that the telephonennr and occupantid gets
> added to the table tblresult.
>
> In my table tbltenants I have some enddates that meet
> that criteria and for some strange reason my routine does
> not pick up these rows.meaning they don't get added to
> the tblresult.also in the query detailsmobile for each
> telephonenr and calldate there is an amount, a sum should
> made of the amounts that fall within the condition:
> If rstsplit!EndDate >= varDateBeg And rstsplit!EndDate <=
> varDateEnd, so for example if the enddate is 01/10/2004
> then a total should be made for all calls made between
> 01/01/2004 and 01/10/2004. Any help is most appreciated.
>