Re: Recordsetclone mistake

From: Alex (anonymous_at_discussions.microsoft.com)
Date: 06/14/04


Date: Mon, 14 Jun 2004 13:59:07 -0700

Thanks a lot again, Dirk.

It's easy to get the sum by using a query for these two
tables and get the form by using it. But, my concern is
that in this case I'll loose the opportunity to edit data
in Table1 directly from the form and I'll need to use
recordset with loop to assign edited data to the table. I
was trying to avoid it.

Please, advise if there is any other ways.

Table1 is actually a variable name (there are some tables
with product code' names). A user chooses this product
code from another form then the program assigns it to
strCode and Me.RecordSource = strCode
tblTable1 tblRate
Operation Rate Code
StaffDay Rate
ShiftDay
StaffAFT
ShiftAFT
RateCode

Alex

>-----Original Message-----
>"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

  • Re: Optimising the Query
    ... SUM ... FROM TABLE1 TAB1 ... FROM TABLE3 ... The query is taking records from TABLE2 and TABLE3 and LEFT OUTER JOIN ...
    (comp.databases.oracle.misc)
  • Re: performance issue in form
    ... I have created a form based on the query which links table1 and table2 by id ... and on the form footer I have a unbound text field which calculates the sum ... But I had a old database which is doing the same task and it populates the ...
    (microsoft.public.access.formscoding)
  • Re: Performance issue in form
    ... Do you have an index on both fields (table1 and table2)? ... Access MVP 2002-2005, 2007 ... Sometimes it takes 5 to 10 seconds to calculate sum, ...
    (microsoft.public.access.reports)
  • Re: vb/access question
    ... Per Tim's correction as to the self join, ... FROM Table1 AS T1, ... > If you have more than one sum to compute then it would be Sum ... but I believe it compares the same fields. ...
    (microsoft.public.vb.general.discussion)