Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397

    Unanswered: Need Default Msg To Disappear

    Hi,

    How can I force the attached by default msg not to appear?

    I m using a combo on a form. I used Not In List event onto that but in this am just opening another form if the new data is not in list. It opens the new fform but also displays the attached msg. I need to make it disappear.? Or How can I come to know its error number so that I could write some code to let it disappear? ( I did not use error trapping)

    Can some one advice me please ?
    Attached Thumbnails Attached Thumbnails MOA.JPG  
    With kind regards,
    Ashfaque

  2. #2
    Join Date
    Jun 2007
    Location
    Maitland NSW,Australia
    Posts
    388
    Use the NotInList event for your field. Look up Help for NotInList. I have some code that allows the user to add a value that is not in the list.

    By the way how do you put color into the title bar of your message?

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    The title bar color just a Windows thing!. At least on my old box (running 98SE) you goto Control Panel
    Display
    Appearence
    Click on the Active Title Bar
    They'll be two Color dropdown boxes
    If they both hold the same color, the Title Bar will be solid
    If you choose different colors, the Title Bar will start as the first color and gradually change to the second

    Some color combiations are very subtle, while others, especially when one is a light color and one a dark color, are very dramatic.

    Linq
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    I have below code on NotInList event

    Private Sub CboBrand_NotInList(BrandNewData As String, Response As Integer)
    Dim BrandSQL As String
    Dim B As Integer
    Dim MSG As String

    'Exit this sub if the combo box is cleared
    If BrandNewData = "" Then Exit Sub

    MSG = "'" & BrandNewData & "' Brand Name not in the list." & vbCr & vbCr
    MSG = MSG & "Do you want to add it?"

    B = MsgBox(MSG, vbQuestion + vbYesNo, "Unknown MadeIn...")
    If B = vbYes Then

    Doccmd.OpenForm "F_ProductMaster"

    Else
    End If

    This works ok but once the F_ProductMaster is opened, the said msg is appearing which I dont want.

    Please advice.
    With kind regards,
    Ashfaque

  5. #5
    Join Date
    Nov 2003
    Posts
    1,487
    LOL...OK, I must of missed something. I can't for the life of me figure out what the title bar has to do with this question....but hey, I've been well known to miss a lot.

    In any case, the underlying problem may not be with your ComboBox but instead with the Form you have just loaded in. Is the Form receiving data from something (code perhaps) that is automatically filling a bound control field (of a different TYPE)? Check the bound controls in your Form and ensure that the data received in those controls are indeed receiving the proper data type as to what is setup in the Table(s) related to that Form. If for some reason your ComboBox is bound then check that Data Type.

    Environment:
    Self Taught In ALL Environments.....And It Shows!


  6. #6
    Join Date
    Jun 2007
    Location
    Maitland NSW,Australia
    Posts
    388
    This maybe typing error Doccmd.OpenForm "F_ProductMaster"
    should be Docmd.OpenForm "F_ProductMaster"

    The following is code that I use for the user to add a city code that does not appear in the list. I have not tried this coding to open a form etc.
    ' ************************************************** ************
    ' allow the user to add a new city to the dropdown
    ' ************************************************** ************
    Private Sub select_port_NotInList(NewData As String, Response As Integer)
    On Error GoTo err_select_port_NotInList

    Dim strmsg As String

    Dim db As DAO.Database
    Dim rst As DAO.Recordset

    Set db = CurrentDb()
    Set rst = db.OpenRecordset("tbl_cities")

    strmsg = UCase(NewData) & " is not in the list" & Space(20) & _
    vbCrLf & " Would you like to add this City Code?"

    Response = MsgBox(strmsg, vbYesNo + vbCritical, "New City Code")

    If Response = vbNo Then
    Response = acDataErrDisplay
    Else
    ' add new city code to the list
    rst.AddNew
    rst("city_code") = UCase(NewData)
    rst.Update
    Response = acDataErrAdded
    End If

    exit_select_port_NotInList:
    Exit Sub

    err_select_port_NotInList:
    MsgBox Err.Description
    Resume exit_select_port_NotInList

    End Sub

  7. #7
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Thanks Poppa,

    Your code is correct to add new data. But I am not intending to add new data. My plan is when the new data entered in combo, it should just display the msg if need to add and upon clicking 'Yes ', it should just open F_Product_master form which it is doing perfectly. (Doccmd was mistyped here in my thread but in code it was Docmd)

    The record source of combo is a query based on a table. This combo is placed on a sub form. Another field on this sub form called ProductName's property is set to required data Yes.

    I just want not to appear this msg when F_Product_master form opens.

    Now when I added error trapping to the code, it displays this new attached msg.

    Can you please advice how can I remove it appearing?
    Attached Thumbnails Attached Thumbnails MOA.JPG  
    With kind regards,
    Ashfaque

  8. #8
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    You could try: Response = acDataErrContinue (and then also set the combobox to Null after that so you can continue to the next field.)
    Last edited by pkstormy; 09-03-07 at 20:33.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  9. #9
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Thanks Poppa, PK

    Error gone out.

    What I did is like this.

    Private Sub CboInsCo_NotInList(InsNewData As String, Response As Integer)
    Dim InsSQL As String
    Dim P As Integer
    Dim Msg As String

    'Exit this sub if the combo box is cleared
    If InsNewData = "" Then Exit Sub

    Msg = "'" & InsNewData & "' Insurance Co is not currently in the list." & vbCr & vbCr
    Msg = Msg & "Do you want to add it?"

    P = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Co....")
    If P = vbYes Then


    Response = acDataErrContinue
    Me.CboInsCo = ""

    DoCmd.OpenForm "F_InsuranceCompanies"

    End If
    End Sub

    Thanks a lot.
    With kind regards,
    Ashfaque

Posting Permissions

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