Results 1 to 4 of 4

Thread: continuos forms

  1. #1
    Join Date
    Dec 2003
    Posts
    4

    Unanswered: continuos forms

    it's always one problem or the other.. so i have a continuos form which contains 3 fields..e.g fname, lname, and ssn..now this continuos form is a subform.. what i would like to do when i click a button, i would like the s.s.n number/numbers (depending on how many) and date field from the main form to transfer to a table which has has 2 colums, s.s.n and date.. with what i have now, when i click the button e.g my subform looks something like this:
    345765877 j fidler
    364778988 m wild
    897654333 p manning

    when i click the button i would like for all ssn + the date to transfer to the table so it can look like this:
    345765877 12/03/03
    364778988 12/03/03
    897654333 12/03/03

    instead, all i'm getting when i press my button is the first row:
    345765877 12/03/03


    plus, how if u have a price field on a continuos form, how can u calculate total(on main form).. i have no idea how to do this....thanks guys, any help is greatly appreciated..

  2. #2
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238

    Re: continuos forms

    Originally posted by mitsu
    it's always one problem or the other.. so i have a continuos form which contains 3 fields..e.g fname, lname, and ssn..now this continuos form is a subform.. what i would like to do when i click a button, i would like the s.s.n number/numbers (depending on how many) and date field from the main form to transfer to a table which has has 2 colums, s.s.n and date.. with what i have now, when i click the button e.g my subform looks something like this:
    345765877 j fidler
    364778988 m wild
    897654333 p manning

    when i click the button i would like for all ssn + the date to transfer to the table so it can look like this:
    345765877 12/03/03
    364778988 12/03/03
    897654333 12/03/03

    instead, all i'm getting when i press my button is the first row:
    345765877 12/03/03


    plus, how if u have a price field on a continuos form, how can u calculate total(on main form).. i have no idea how to do this....thanks guys, any help is greatly appreciated..

    If I'm understanding you correctly, after the button is clicked, you want all records on the subform to be added to the other table... Just checking, but is it possible for the same person to show up on different dates?... I mean, I doubt you would want "364778988 12/03/03" and then "364778988 12/04/03" right?

    If the same SSN number is not going to show up more than once, you simply need to do an append query in the button's on click event... Use the subform's recordset in the SQL statement... What's in your On Click event right now?

    As for getting the total of the price field from the continuous form onto the Main Form... First I would add a text box to the Form Footer section of the subform... The Control Source would be "=Sum([yourPriceTextBoxName])"... Make the text box and/or the form footer section of the subform "Visible = False" ...Then... Wherever you want the Total to show on the Main Form... add a text box... The Control Source would be something like "Me!sfrmName.Form!txtTotalsTextBoxName"... (Of course, you'll need to change the control names as needed)

    HTH

  3. #3
    Join Date
    Dec 2003
    Posts
    4

    Re: continuos forms

    Trudi,
    th claculation is not working, its working on the subform footer but on the main main its showing "#name".. the textbox on the subform(called checkout) where the price calcs is called text9 so on the main form, i set the source of the textfield to Me!checkout.Form!text9.. what am i doing wrong???

    and for the other one, its actualy unique products and date so what i have now is:
    Dim newbob As DAO.Database
    Dim checkoutitems As DAO.Recordset
    Set newbob = CurrentDb()
    Set checkoutitems = newbob.OpenRecordset("Transaction")
    checkoutitems.AddNew
    checkoutitems!ProductId = Me!checkout!product
    checkoutitems!CustomerID = Me!Text5
    checkoutitems!Date = Me!Text1
    checkoutitems.Update
    checkoutitems.Close
    Set checkoutitems = Nothing
    Set newbob = Nothing
    DoCmd.Close

    but all this is doing is adding the first product and date to the transaction table ???? helppppp

  4. #4
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238

    Re: continuos forms

    Here's a great link about how to reference subform controls and properties properly... (to avoid those pesky Name errors)...
    http://www.mvps.org/access/forms/frm0031.htm

    The proper syntax for what you are trying to do (refer to a control on a subform from a main form) is "Me!Subform1.Form!ControlName" where Suborm1 is the name of the subform CONTROL on the main form... not necessarily the name of the subform itself... (unless you've named both the same)... Make sure that you've got that part of the syntax correct, because this is a very common error...

    As for updating the records... well... I'm a bit confused...

    First of all, the code you have is definitely only going to add one record... That is what you are asking it to do... That makes sense, but obviously that's not what you want to do...

    Let me ask a few questions to clarify...

    In your code, you are inserting into the new record the values from three form controls... One control from the Subform and two controls from the main form...
    checkoutitems!ProductId = Me!checkout!product
    checkoutitems!CustomerID = Me!Text5
    checkoutitems!Date = Me!Text1

    First question... If you want to insert a new record to the Transaction table for every record on the subform, do you not want different values for the CustomerID? I could see the date staying the same for all records added, but the CustomerID?

    Second question... What is the recordsource for the subform?

    Third question... Is it possible for you to post a small sample of the forms and data involved??... There are a few ways to accomplish what you are trying to do... Personally I'd probably execute an "INSERT INTO" SQL statement in the on click event for the button... but I'd at least need the field names from the subform's recordsource... It would just be so much easier to help if I could see what you've already got...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •