Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    mladen273 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    19

    Create a mgbox without default button

    Hi,

    How can I create msgbox without default button?
    Is it possible?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Sorry but I'm not sure what you want. No buttons? How do you dismiss the MsgBox?

  3. #3
    mladen273 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    19
    I've created a program in Access to scan barcode.
    If scanned barcode that is not in the database I get a message ...
    In MsgBox I have the buttons yes and no.
    My problem is if they continue to scan the notice is confirmed over the scanner.
    I wish that could be confirmed only through the mouse.

    Is this possible?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    You do know you can set the button that has the default focus, right?

  5. #5
    mladen273 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    19
    I don't know how to set focus.
    I know how to set defaul button, but don't set focus.

    Can you help me?

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    How about posting your MsgBox line of code for us to see?

  7. #7
    mladen273 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    19
    Private Sub Skeniranje_Click()
    Dim Sken As String


    DoCmd.SetWarnings False
    Sken = "?"
    While Sken = "?"
    Sken = InputBox("Upiši barkod", "Sken", , 1, 15)
    If Sken <> "" Then
    CurrentDb.Execute "INSERT INTO Sken VALUES ('" & Sken & "');"
    Me.Refresh
    Sken = "?"
    If IsNull(Forms![frmSkeniranje]![qSkenUkupno subform].Form![Artikl]) Then
    MsgBox "Artikl nije u bazi,", vbOKOnly + vbInformation, "Obavijest"

    End If
    End If


    Wend


    End Sub
    Last edited by mladen273; 02-16-2013 at 03:43 PM. Reason: Wrong code

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    The Default button is the one that gets the focus. Your scanner is undoubtedly supplying a CarriageReturn at the end of the scan and that presses the button with the focus (default).

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Ahh...a vbOKOnly MsgBox. Hmm...<scratches head>
    You may be stuck here simply coming up with your own form for a Message that requires the user to enter a certain sequence in a TextBox to dispatch the warning form and prove they have seen it.

  10. #10
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by RuralGuy View Post
    Ahh

    ...a vbOKOnly MsgBox. Hmm...<scratches head>...
    You're not confused, Allan! Well, no more than we usually are! The OP did say that in his Messagebox "...I have the buttons yes and no..."

    How about a simply Popup/Modal Form with a Button captioned "OK," but coded to close the Form, or do whatever else needs to be done?

    Linq ;0)>

  11. #11
    mladen273 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    19
    Can someone help me with this problem?
    How can I create focus to form?
    I have try with code before msgbox form.focus but nothing is happend.

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    How about a standard MsgBox with two buttons and the 2nd button has the focus. You can test the results and not accept the default button and put up the MsgBox again?

  13. #13
    mladen273 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    19
    Quote Originally Posted by RuralGuy View Post
    How about a standard MsgBox with two buttons and the 2nd button has the focus. You can test the results and not accept the default button and put up the MsgBox again?
    I have try with 2nd button, but always same problem

  14. #14
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Try something like the following:
    Code:
    Private Sub Skeniranje_Click()
       Dim Sken As String   '   DoCmd.SetWarnings False
       Sken = "?"
       While Sken = "?"
          Sken = InputBox("Upiši barkod", "Sken", , 1, 15)
          If Sken <> "" Then
             CurrentDb.Execute "INSERT INTO Sken VALUES ('" & Sken & "');"
             Me.Refresh
             Sken = "?"
             If IsNull(Forms![frmSkeniranje]![qSkenUkupno subform].Form![Artikl]) Then
                Dim MyAnswer As Integer
                MyAnswer = vbCancel
                Do While MyAnswer = vbCancel
                   MyAnswer = MsgBox("Artikl nije u bazi,", vbOKCancel + vbCritical + vbDefaultButton2, "Obavijest")
                Loop
             End If
          End If
       Wend
    End Sub
    ...WARNING: UNTESTED CODE...

  15. #15
    mladen273 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    19
    Quote Originally Posted by RuralGuy View Post
    Try something like the following:
    Code:
    Private Sub Skeniranje_Click()
       Dim Sken As String   '   DoCmd.SetWarnings False
       Sken = "?"
       While Sken = "?"
          Sken = InputBox("Upiši barkod", "Sken", , 1, 15)
          If Sken <> "" Then
             CurrentDb.Execute "INSERT INTO Sken VALUES ('" & Sken & "');"
             Me.Refresh
             Sken = "?"
             If IsNull(Forms![frmSkeniranje]![qSkenUkupno subform].Form![Artikl]) Then
                Dim MyAnswer As Integer
                MyAnswer = vbCancel
                Do While MyAnswer = vbCancel
                   MyAnswer = MsgBox("Artikl nije u bazi,", vbOKCancel + vbCritical + vbDefaultButton2, "Obavijest")
                Loop
             End If
          End If
       Wend
    End Sub
    ...WARNING: UNTESTED CODE...
    Thx, this is awsome, finally is working.

    B.R.
    Mladen

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 12-05-2012, 11:33 AM
  2. Use a button to create a query on the fly
    By DuWayne in forum Queries
    Replies: 2
    Last Post: 12-25-2011, 07:30 PM
  3. Button to Create New Record
    By Pam Buckner in forum Access
    Replies: 3
    Last Post: 10-14-2011, 09:46 AM
  4. Replies: 6
    Last Post: 07-20-2011, 11:54 AM
  5. Overriding the default add new button
    By saleemMSMS in forum Programming
    Replies: 0
    Last Post: 08-26-2009, 05:12 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