Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2003
    Posts
    34

    Unanswered: Quick question: data into popup form

    I have a large form: BProfile.

    I have a button on the large form that opens up a small form: AddBAgent. This small form adds data to the Agent table and, upon closing, updates and goes back to the BProfile form. I have a field in BProfile called "CompanyID", I have the same field in AddBAgent when it pops up.

    All I need to know is, how can I pass the CompanyID from BProfile into AddBAgent?

    Thanks in advance!

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    You can pass it as an opening arguement:

    DoCmd.OpenForm "PopUpForm", , , , , , Me!CompanyId

  3. #3
    Join Date
    Oct 2003
    Posts
    34
    Hmm. That didn't seem to work. Okay, pertinent bit of data: the information I'm wanting to pass in is coming from a selection on a combo box. Sorry I didn't mention that before, if it's significant. I'm very new at this.


    Originally posted by jmrSudbury
    You can pass it as an opening arguement:

    DoCmd.OpenForm "PopUpForm", , , , , , Me!CompanyId

  4. #4
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    If the popup form has a record source, you can open it specifying the where clause:

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "PopUpForm"
    stLinkCriteria = "[CompanyID]='" & Me!CompanyId & "' "
    DoCmd.OpenForm stDocName, , , stLinkCriteria

  5. #5
    Join Date
    Oct 2003
    Posts
    34
    *wince* Nope. Not that either... it just keeps coming up "0".


    Originally posted by jmrSudbury
    If the popup form has a record source, you can open it specifying the where clause:

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "PopUpForm"
    stLinkCriteria = "[CompanyID]='" & Me!CompanyId & "' "
    DoCmd.OpenForm stDocName, , , stLinkCriteria

  6. #6
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    If the second solution did not work, then go back to the first solution. In the FormLoad event of the PopUpForm, add the following code:

    if isnull(Me.openargs)=0 then CompanyId = me.OpenArgs

  7. #7
    Join Date
    Oct 2003
    Posts
    34
    Thank you thank you thank you! That worked!

Posting Permissions

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