Results 1 to 7 of 7
  1. #1
    JayX is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    62

    Exclamation Message Box


    When a command button is clicked is there a way to have a message box appear saying "Enter a number" which you type a number within that message box, hit ok, and then have that number appear in a text box?

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Use the inputbox function instead of Msgbox.

    From MS Access help:

    Displays a prompt in a dialog box, waits for the user to input text or click a button, and returns a String containing the contents of the text box.

    John

  3. #3
    JayX is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    62
    I am not too familiar with access, is there a certain code to do this?

  4. #4
    JayX is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    62
    and How do I get the number to appear in a specific textbox

  5. #5
    robsworld78 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    181
    You could also create your own message box, just make another form, set it to popup add the field from the table you want the data in and add an OK button. On the OK button afterupdate event add code to have it close the popup form and refresh the textbox on the main form so it reveals the data the user entered on the popup. Doing it this way you can customize the look of the message box.

  6. #6
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    In its simplest form your code would be something like:

    Me![textboxName] = inputbox("Please enter a value:")

    To ensure you get only numerics, you could use:

    Me![textboxName] = val(inputbox("Please enter a value:"))

    Now, where you put that code depends on what you are doing with the form, and how. But, from your description, it would be in the On-Click event of the command button.

    John

  7. #7
    JayX is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    62
    Works great, thank you!

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

Similar Threads

  1. Help with message box
    By Cablenm in forum Access
    Replies: 9
    Last Post: 10-14-2011, 05:06 PM
  2. Message Box
    By BorisGomel in forum Programming
    Replies: 6
    Last Post: 04-25-2011, 02:16 PM
  3. Message Box
    By dunnmel4 in forum Programming
    Replies: 9
    Last Post: 04-12-2011, 10:44 PM
  4. Message Graphics
    By pkstormy in forum Access
    Replies: 0
    Last Post: 01-01-2011, 10:48 PM
  5. message box help
    By shaz10010 in forum Forms
    Replies: 1
    Last Post: 04-17-2009, 09:11 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