Results 1 to 4 of 4
  1. #1
    dr223 is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    20

    cmb box selection

    Hi,

    I have a combo box called cmbcri1, I also have a button called Submit.



    When this button is clicked and cmbcri1 has no selection done then a message box should be sent..

    "All fields are mandatory"

    any help please

    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Code:
    If Len(Me.cmbcri1& vbNullString) = 0 Then
      MsgBox "You need to fill out cmbcri1"
      Exit Sub
    End If
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    dr223 is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    20
    Ok..

    Note: Am working with Access 2003.

    So I have a Submit on the form, when clicked it checks if the cmbcri1, cmbcri2 etc have values.

    Therefore, On click event of the button I have;

    Code:
    If Len(frmMain.cmbcri1& vbNullString) = 0 Then
    MsgBox "You need to fill out cmbcri1"
      Exit Sub
    End If
    The first line is an error and highlighted in RED-

    If Len(frmMain.cmbcri1& vbNullString) = 0 Then

    Note: I changed Me.cmbcri1 to frmMain.cmbcri1.

    It gives a compile error at vbNullString

    Can I check all the combo boxes within 1 if statement?

    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,521
    Sorry, typo on my part. Go back to the Me syntax and add a space before the &.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. lookups and data selection help
    By benjammin in forum Access
    Replies: 3
    Last Post: 11-28-2010, 04:45 PM
  2. Vendor Selection!!
    By skylitz in forum Access
    Replies: 2
    Last Post: 08-16-2010, 04:09 AM
  3. Pop-up Combo Box Record Selection
    By AKQTS in forum Forms
    Replies: 1
    Last Post: 08-11-2010, 01:01 PM
  4. Subform Selection
    By doug adams in forum Forms
    Replies: 2
    Last Post: 06-28-2009, 10:27 PM
  5. Data selection
    By cesander in forum Forms
    Replies: 0
    Last Post: 09-18-2008, 02:24 PM

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