Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2004
    Posts
    63

    Unanswered: Multiple poup pickers with only one form

    Hello,

    Can anyone help?
    I need to have a pop up, and send a number back to a textBox depending on which button is clicked in the popup. I can do this, but now I am struggling with how to only use one form popup to allocate these (there are 12 in total).

    I tried passing the refering name by putting it in quotes or not putting it in quotes, but it didn't work correctly.

    This is my starting point:
    Code
    'Main Form:

    Private Sub AA1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim stDocName As String
    Dim stLinkCriteria As String
    Set_Value1 "[Grade1]"
    stDocName = "LevelPicker"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit_Command6_Click:
    Exit Sub

    End Sub

    'On the Secondary Form (popup):

    Dim ReferingBox As String
    Dim CompleteReferer As String

    ReferingBox = Get_Value1()
    CompleteReferer = "Forms![Pupils]!" & ReferingBox

    'An Example of one of the buttons.

    Private Sub Y710_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Forms![Pupils]![Grade1] = 10 ' This is the Syntax I am after
    DoCmd.Close
    End Sub

    END CODE

    Value1 is defined as a global variable elsewhere and works fine.

    So I need some way of stringing that all together and then assigning the value to the box rather than having to assign it as above.
    I have seen other examples, but they don't seem to work in this instance.

    Thanks,
    ChrisOfCatford

  2. #2
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    Try this:

    CompleteReferer = Forms("Pupils").Controls(ReferingBox)

    Greetz

  3. #3
    Join Date
    Sep 2004
    Posts
    63
    Thanks namliam,

    But how do I use that CompleteReferer from clicking the button?

    I need to do the equivelant of:
    CompleteReferer = 10
    Or whatever it is. Only CompleteReferer needs to look like the contol on the first form. Obviously the above would redefine the variable and not the contents of the box.

    Thanks,
    ChrisOfCatford

  4. #4
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    You want to get the value of a text box on another form?

    Is that your question?

    [Forms]![FormName]![ControlName]

    Will do that for you... as will the following

    Forms("FormName").Controls("ControlName")

    Greetz

  5. #5
    Join Date
    Sep 2004
    Posts
    63
    Yes, but I need to have that happen dynamically.
    Let me try and explain.

    Box1------\
    Box2-------\ On Click open a new formIt was Box2)
    Box3-------/
    Box4------/

    New form:

    Button1Example(assigns a value of "Turnip" to the original box)
    Click---(it came from Box2)----OriginalForm!Box2="Turnip".

    Sorry about the Turnip, they are numbers really .
    I know there is a way, just can't get it.

    Thanks,
    ChrisOfPeckham

Posting Permissions

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