Results 1 to 11 of 11
  1. #1
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194

    set form = [dynamic form name??] how to set it?

    Hey everyone,



    I have a form [A] which opens [B]

    [B] runs a bunch of codes and then sends data back to [A] in text boxes.

    [C] is identical to [A]

    can i have [C] open [B] and then B sends the data back?

    Or do i have to have
    A -> B
    C -> D??

    I have things in [B] like Forms!A!textbox.value = 0

    How can i make the A part dynamic depending upon which form sent the user here?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by gangel View Post
    ...[B] runs a bunch of codes and then sends data back to [A] in text boxes....
    Is form A unbound? Why not write data to tables? If you need to use variables, there are ways to make variables available globally.

  3. #3
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194
    yes i do need to use variables, no the data is not stored in a table

    Its a very long story :P but im sure this is the way i need to do it.
    it does also save data to tables, but yes tehre are some text boxes too

    I have looked into TempVars

    But i seem to have mis-stepped


    SO in form A before going to form B

    Code:
    dim tmpFrm as TempVars
    
    Set tmpFrm = [Forms]![FormA]

    Then on FormB
    Code:
    Dim tmpfrm as tempvars
    
    tempvars!tmpfrm![Textbox].text = ""

    am i at least on the right track?

  4. #4
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194
    its coming back with a type mismatch at the
    tempvars!tmpfrm![Textbox].text = "" part

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    If C is identical to A then why not send the values back to C?

    You could have C reference values within A if it is open. Storing the values in Global Variables within a Standard Module may be an option. You need to manage error trapping when doing this because a Runtime Error will erase all variables dimensioned in memory.

    As for Temp Vars, I do not have experience with them. I either use Global variables or Custom Classes.

  6. #6
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194
    ok, how can i do this with global variables then?

    C and A are identical in terms of having the same text box names and such, but they are different types of tables

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by gangel View Post

    C and A are identical in terms of having the same text box names and such, but they are different types of tables
    So both A and C are bound to tables/queries?

  8. #8
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194
    yes they are

  9. #9
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194
    pretty much my question is;

    If i have

    Dim tmpfrm as Form

    and then
    Set tmpfrm = Forms(FormA)

    How do i recall this properly to make it show
    Forms!FormA!textbox.text

  10. #10
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by gangel View Post
    yes they are
    I thought you mentioned earlier that they are unbound forms. Since they are bound, the data is in the table. There is not any need to use variables or tempvars. You can simply take a trip to the table. You can use something like DLookup, or DAO, or a hidden subform.
    https://msdn.microsoft.com/en-us/lib.../ff834404.aspx

    Having said that, if the data you need is available in form C, just reference the form from form B.

  11. #11
    gangel is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2014
    Posts
    194
    k, i really do appreciate the help but i think we are off track, i've probably mis communicated my issue.

    lets get away from bound or unbound, my issue isnt with this situation, i understand the theories and the reasons for the forms.

    If i have a list of... "suburbs" in a form that pops up

    I then have table with items called "Customers" and another table called "employers"

    When i create a customer, the suburb form pops up, you choose a suburb. It then allocates SuburbID to customer table

    When you open Employers, the same thing needs to happen.

    But if the VBA code in the form for Suburbs has [Customers]![SuburbID] saved in it, then the suburb form will send data to customers.

    What i need is for the form to send data to customers if customsers opened it, or send data to Employers table if employers form opened it...

    Thus looking for a temp var or global var that can replace the table name as both have the same ID of SuburbID in them that i can use the same suburb lookup form for, i just need to have the table NAME as a variable

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

Similar Threads

  1. Creating a Form for Dynamic Table
    By Ashe in forum Forms
    Replies: 7
    Last Post: 02-25-2014, 12:10 PM
  2. Dynamic refresh of form
    By jle0003 in forum Forms
    Replies: 6
    Last Post: 10-11-2012, 01:33 PM
  3. Build a DYnamic Continuous Form
    By Rawb in forum Forms
    Replies: 4
    Last Post: 08-20-2012, 03:21 PM
  4. Dynamic Form, Dynamic labels/ captions?
    By JFo in forum Programming
    Replies: 15
    Last Post: 10-12-2011, 08:33 PM
  5. Dynamic Form and memory limit
    By pmi in forum Access
    Replies: 5
    Last Post: 10-07-2011, 09:49 AM

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