[AccessD] Not In List Event

Rocky Smolin rockysmolin at bchacc.com
Mon Nov 1 19:22:00 CDT 2010


Dear List:

I am trying to implement a NotInList event on a bound combo box.  The new
value is added OK to the table that the query that is the Row Source uses to
populate the bound combo box.

But after it adds the value I still get the standard message as if the
NotInList event didn't fire ("The text you entered isn't an item in the
list...")  fldPercentValue is a number - double precision and is stored as a
decimal fraction.  The format of the combo box is Percent.  

Here's the code.  But it's working OK.

    intReply = MsgBox("The value " & NewData & " is not in the " &
Me.fldBaitPercent.Tag _
        & " percent list. Do you want to add it?", vbYesNo)
    If intReply = vbNo Then
        Response = acDataErrContinue
    Else
        Set db = CurrentDb
        Set rs = db.OpenRecordset("Select * FROM tblPercents")
        rs.AddNew
        rs!fldPercentType = Me.fldBaitPercent.Tag
        rs!fldPercentValue = NewData
        rs.Update
        rs.Close
        Set rs = Nothing
        Response = acDataErrAdded
    End If


The values for fldPercentValue added to the table look like 0.1, 0.2, etc.
They have the leading zero.  If I key in a new value with the leading zero
like 0.4, it works OK.  But if I try to add .4 it barfs.  If it was just me,
I'd always add the 0 but the user won't like it.  They'll want to enter .4
without the leading zero.

How can I finesse this one?

MTIA,

Rocky Smolin

Beach Access Software

858-259-4334

Skype: rocky.smolin

www.e-z-mrp.com <http://www.e-z-mrp.com/> 

www.bchacc.com <http://www.bchacc.com/> 

 

 



More information about the AccessD mailing list