Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2009
    Posts
    7

    Unanswered: Popup calculator problem linked forms

    I am trying to create a popup that is basically a calculator for the user. The value will be calculated via this popup and then copied for a few records in the main form (as a continuous form). It then may need to be calculated again using different numbers, with this new calculation used for future values.

    if the records are linked and i have the same box on both forms, how do i update the first form to make it show the value typed in the box that is in the popup.

    The only way I can do it at the moment is by closing and reopening the form, but i have a macro that runs when the form opens which is not needed for this situation and will cause problems (this macro is needed for another reason so removing it is not an option).

    When the user opens the form, its' onload macro runs a query to find a specific record that is joined to many others via a subform. The user then adds more records to this specific record via the subform. As the macro runs a query, I have thought that maybe if the value chosen by the user can be remembered by access and used again when the macro runs again for the next instance, this would solve the problem, but I have no idea how to do this what so ever .

    I have tried refresh and refresh page in various different events on the form properties but nothing works - with my limited knowledge its a bit 'hit and miss'.

    Without closing and then reopening the main form i get a duplicate value error if i type in the box in the main form (which looks empty, although it has has some data enterered into it via the popup). If i do, however, open the popup on say record 1, type a value in, manually close the form and reopen it, go into the popup and change the value, it now updates the value in the main form as i want it to.

    Hopefully I have explained this ok.

    Please help.

    Peter

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I personally would put a button on the form to open the calc program. In the Onclick of that buttuon, you'd write something like
    Call Shell("calc") (to show the calculator)

    "if the records are linked and i have the same box on both forms, how do i update the first form to make it show the value typed in the box that is in the popup."

    To make first form show the value in popup form, write some code in your event (ie. onclick event for a button) which copies that value to the first form.) ex:
    Forms!My1stForm!MyXXXXfield = Forms!MyPopUpForm!Field2Value But be careful on refreshing your recordsets after doing this (ie. Refresh).

    Anything you do in a macro can easily be done through vba code. If you want MSAccess to remember a value, create a public variable in a module. You should be able to utilize that anywhere pasing values into/out of it.

    You can always upload your mdb for one of us to quickly look at and help you further.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Jun 2009
    Posts
    7
    Hi thanks for the reply.

    I am ok with setting up all the forms and they are linked the problem is it wont refresh without close/reopen. I have attached my database (remove.zip from end of file).

    1) If you open 'frmA' and click cancel on the query that comes up.

    2) Type anything in the box next to 'part batch number'

    3) Type a number in 'roll' (this has input mask 00#).

    4) Then click on the 'calculator' button to open the popup.

    5) Type a value in the box next to 'Base (Copy Value Above)'

    6) Then click 'close' on this popup - it doesnt show in the form, but if you type in the white box below row and try to move to another record, it gives a duplicated entries error.

    I have tried refresh in different areas but don't really know were it needs to go - I am very much a begginer at access.

    Thanks Again
    Attached Files Attached Files

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Sounds like it doesn't need a refresh, but a requery.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Jun 2009
    Posts
    7
    anyone any other thougths?

Posting Permissions

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