Results 1 to 7 of 7
  1. #1
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76

    acDialog issue

    I have button on a form that does this:
    Dim arNumber As String


    DoCmd.OpenForm "Frm_Rlookup", acNormal, WindowMode:=acDialog


    arNumber = Forms!Frm_Rlookup!cmboARlookup
    MsgBox "User input was: " & arNumber
    DoCmd.Close acReport, "Frm_Rlookup"

    The problem is that once the user selects data from “frm_Rlookup” nothing happens. Adding a form close to afterUpdate crashes the code.
    I hope someone can tell me what I am missing and the next step.

  2. #2
    JamesDeckert is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    You're opening the form as a dialog box meaning that the code after it won't execute until the dialogbox closes.
    So there will be no form to look at when you are looking for it.

    What are you trying to accomplish?

    You can open a form as a non-dialog box, look at the data in your code. Then have your code close the form. But that'll take some looping to check when the data has been entered.
    There is probably a better way, if we know what you're trying to do.

    I have a form pop up to select options for a report, but after I've selected the options, I have the form open the report and the report can see the form. Then the form has an exit form button.

  3. #3
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76
    Here is what I want to accomplish:
    i have 2 forms: "invoice" and "rental"
    The user creates a rental and prints it out. they then have to type a few key fields into the invoice form from paper.
    What I want is for the user to open the Invoice form, click a button called "new rental", something pops up that asks what the rental number is, the user selects the rental number and the relevant data is copied form "rental" to the invoice.
    I have this working fine when there is no popup, all I want to do is move the comboBox selector for the rental number form the Invoice form to a pop up form.
    i hope this is clear, thanks.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Code will continue if you hide the form rather than close it. You should probably decide whether it's a form or report too.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    lzook88 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    75
    Can you post a sample database for us to look at. May give us a better understanding of how we can help you.

    What it sounds like is you need to set the form itself to POPUP = YES and not use the windowmode code in the vba side. The POPUP = YES is in the FORM properties in design mode. If you do this and open the form the normal way (not using acdialog) it should open and not pause your code.

    Thanks,
    Z
    To provide db: Make copy, remove confidential data, run compact & repair, zip w/Windows Compression if over 500KB (2MB zip allowed), attach to post. Attachment Manager is below the Advanced post editor window, click Go Advanced below the Quick Reply window.
    If any suggestion resolves your issue, please use the Thread Tools dropdown above first post and mark as Solved!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Quote Originally Posted by lzook88 View Post
    If you do this and open the form the normal way (not using acdialog) it should open and not pause your code.
    That wouldn't be desirable.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    ShostyFan is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    76
    Okay I got it, thank you for the replies.
    The issue I had was when the dialog box was open and the user set a value, I was trying to have the non dialog box form import the data.
    Now I have a dialog box open, the user sets the data, and before the dialog box closes it sends the data to the main form, then the dialog closes and my vba can go back to work on the main form.
    thanks.

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

Similar Threads

  1. acDialog
    By ShostyFan in forum Programming
    Replies: 5
    Last Post: 10-03-2015, 06:39 PM
  2. Replies: 5
    Last Post: 01-08-2015, 02:08 PM
  3. CDate and CStr issue with "Invalid Use of Null" Issue
    By excellenthelp in forum Queries
    Replies: 3
    Last Post: 07-25-2014, 01:34 PM
  4. Replies: 22
    Last Post: 05-21-2013, 07:54 PM
  5. Replies: 8
    Last Post: 05-06-2013, 03:14 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