Re: Recordsetclone mistake

From: Dirk Goldgar (dg_at_NOdataSPAMgnostics.com)
Date: 06/14/04


Date: Mon, 14 Jun 2004 16:07:33 -0400


"Alex" <anonymous@discussions.microsoft.com> wrote in message
news:1c79901c45249$ebaf9720$a001280a@phx.gbl
> Thanks a lot, Dirk.
>
> As you asked for an explanation, I need to get a total for
> txtDol to show it in the textbox1 on a formfoot of a
> continious form.
> This continious form is linked with Table1 to be able to
> edit data there from this form.
>
> txtDol on this form = [txtRate]*([txtShiftDay]*
> [txtStaffDay]+[txtShiftAFT]*[txtStaffAFT]) where
>
> txtRate = Control Source = [cboRateCode].Column(1)
> cboRateCode has Control Source [Rate Code] from Table1 but
> Row Source is Table2.
>
> ii = [txtRate]*([txtShiftDay]*[txtStaffDay]+[txtShiftAFT]*
> [txtStaffAFT]) gives a mistake because it cannot recognize
> txtRate. It says "Run-time error '2447'. There is an
> invalid use of the .(dot) or ! operator or invalid
> parentheses."
>
> When I'm using the advised by you the same but with "!"
> (!txtTextBox]) I'm getting "Error '3265'. Item not found
> in this collection."

That's because, as you now explain, these text boxes -- at least,
txtRate -- are not fields in the form's recordset; they are unbound
controls on the form. So the form knows about them, but its recordset
does not.

I think the best way to go about this is to base the form, not on
Table1, but on a query that joins Table1 and Table2 appropriately and
picks up the necessary fields from Table2. Then you can just use the
Sum() function to calculate the total for the text box in the form's
footer.

If you will please post the true names and field lists from the both
"Table1" and "Table2" -- and any other tables that are involved -- I may
be able to give more specific advice.

-- 
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)


Relevant Pages

  • Speed of Code
    ... corresponding entries in Table2 and pull a couple of fields from Table2 into ... Table1 where those ITEMS are equal and the date is of the latest date. ... How I do this now is open table 1 as a recordset, ... When I reach the end of Table2 I use a DO LOOP to start table 1 at ...
    (microsoft.public.access.formscoding)
  • Re: About NextRecordSet
    ... Table1:= asp.NextRecordSet; ... Table2:= asp.NextRecordSet; ... > method my current recordset was changed. ... > iDummy: Integer; ...
    (borland.public.delphi.database.ado)
  • Re: Is there a solution to this?
    ... > Lets say I have two tables, table1 and table2 that have a one to one ... > The resulting recordset can be modified but if new records are added to ... then it gives a write conflict. ...
    (microsoft.public.access.adp.sqlserver)
  • Is there a solution to this?
    ... Lets say I have two tables, table1 and table2 that have a one to one relationship ... The resulting recordset can be modified but if new records are added to this, then it gives a write conflict. ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Tricky Visual Basic Code help...
    ... moves the current record into a new record in table2. ... this with a little VBA code and a couple custom queries. ... Set a "pushFlag" column in the record in table1 to a specific ... If a duplicate is not found, ...
    (microsoft.public.access.formscoding)