[AccessD] Not In List Event

Jurgen Welz jwelz at hotmail.com
Mon Nov 1 19:44:02 CDT 2010


If you use a PK in column(0) of the combo and bind to that column, you can set the value to the PK of the added record and use the dataerrcontinue parameter of the notinlist event after requery of the combo.  That way a .4 will show up as 0.4 after the record append.  If no PK in column(0), you can probably use the domain aggregate DLast function to look it up and set the combo to that value after cancelling the error.

Ciao Jürgen Welz Edmonton, Alberta jwelz at hotmail.com


 
From: rockysmolin at bchacc.com
To: accessd at databaseadvisors.com
Date: Mon, 1 Nov 2010 17:22:00 -0700
Subject: [AccessD] Not In List Event

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/> 
 
 
 
 
 

-- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com 		 	   		  


More information about the AccessD mailing list