[AccessD] Not In List Event

Rocky Smolin rockysmolin at bchacc.com
Mon Nov 1 20:17:34 CDT 2010


Jürgen:

No PK this time.  There are four of these fields in the table where the user
wants to pick values from a combo box. So there will be eventually four of
these combo boxes, each for a different field.  The bound column is actually
the second column.  But I'm not sure where to put the DLast function - after
the Response = acDataErrAdded statement?

TIA

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jurgen Welz
Sent: Monday, November 01, 2010 5:44 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Not In List Event


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