Results 1 to 11 of 11
  1. #1
    ick64 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    22

    Setting a value in another form

    Hello all,



    I can use DLOOKUP to retrieve a value from a table and use it in a field in the current form.

    But how can I take a value from my current form and use it in another form?

    This is what I need: Form1 is open and whenever I input a value in a specific field, there is an "after update" sub to take this value to a field in Form2.

    How can I do it?


    Thank you!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,523
    just use the full path:

    forms!myForm1!txtbox1 = forms!myForm2!txtbox2

  3. #3
    ick64 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    22
    Thank you ranman256 but I have realized my question was not complete.

    Actually, with the value taken from a field in the current form, I need to access another table and set that value to one of its fields. Simply putting, it would be the reverse of DLOOKUP...

    Any tip?


    Thanks again!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    The original question was complete enough but now your question is completely different.

    Why duplicating data between tables?

    Would have to run an SQL UPDATE action to directly populate field in table.

    But if you have 2 forms open why not use ranman's suggestion?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ick64 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    22
    Thank you June.

    The valid question is really the 2nd one then. Actually I am duplicating data because I do not know how to run SQL UPDATE etc. - I am a newbie in Access...


    Thanks again!

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    Still doesn't explain why you need to duplicate the value in two tables. Has nothing to do with HOW it is entered into the second table. Why is it there at all?

    Really need more info about what this db is for and its structure.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    ick64 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    22
    For short, one table (letīs say Table1) - and its form - is about internal request of quotes (RFQ). The other table (letīs say Table2) - and its form - is about the quote for the customer.

    I read some fields from Table1 to start populating data at Form2 (table2), and then, whenever the quote is accepted and I fill in the acceptance date, I want this info to populate a date field in Form1 (Table1).

    Later on I want to be able to run reports either from Table1 and Table2, checking which request of quotes turned into deals, which quotes turned into deals and when, etc.


    Thank you!

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,896
    Do the tables have a relationship? Is a primary key from Table1 saved as foreign key in Table2?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    ick64 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    22
    No, they are not related...

    Thank you!

  10. #10
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Separate these forms into two unrelated forms.
    - form 1, add a new quote (or look up an existing one), show all the data from table1
    - form 2, select a record from table1 to add a new quote, or select a record from table2 to display an existing one

    When you add a new quote for form 2,
    - provide a combobox of all records from table1 with no accepted date
    - user selects one from this list
    - run an append query, append the fields to table2 (only the fields that are missing from table1, these two tables should be linked so that no duplication of data is necessary)
    - now you have a quote record in table2 where you can begin updating the data
    - in the AfterUpdate of form 2, run an update query to add the accept date to the table1 record

  11. #11
    ick64 is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    22
    Great _ I will do it, thanks a lot!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Setting the value of a TextBox on a Form
    By RunTime91 in forum Access
    Replies: 17
    Last Post: 09-19-2017, 02:37 PM
  2. Setting a variable of type form to an existing form
    By GeorgeJ in forum Programming
    Replies: 9
    Last Post: 12-16-2014, 01:14 PM
  3. Setting default value to zero in form box?
    By dekhelia in forum Forms
    Replies: 6
    Last Post: 10-17-2013, 08:53 AM
  4. Replies: 5
    Last Post: 01-03-2013, 07:47 PM
  5. Setting paths different for each form
    By sailinxtc in forum Programming
    Replies: 9
    Last Post: 04-04-2010, 09:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums