Closed Thread
Results 1 to 3 of 3

Adding msgbox to code

  1. #1
    Registered User
    Join Date
    03-26-2009
    Location
    uk
    MS-Off Ver
    Excel 2003
    Posts
    6

    Adding msgbox to code

    have the following code.
    What this code does is take value from a combo box and fill out a text box. I need to change it so that if any of the combo boxes havent got a selected value then a message box appears saying "please fill out the whole form" at the moment i get a debug error because the value is null.

    Private Sub cmdGenerate_Click()
    Dim tmpStr As String
    tmpStr = Left$(cboPWP.BoundValue, 7) & "-"
    tmpStr = tmpStr & Left$(cboFunction.BoundValue, 3) & "-"
    tmpStr = tmpStr & Left$(cboDT.BoundValue, 3) & "-"
    tmpStr = tmpStr & Left$(cboOriginator.BoundValue, 50)
    strCode = tmpStr
    txtCode.Value = tmpStr
    tmpStr = vbNullString
    End If

    Thanks in advance.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: Adding msgbox to code

    Hi sukyb1

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Adding msgbox to code

    X-post here.
    Remember what the dormouse said
    Feed your head

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1