[AccessD] Not In List Event

Gustav Brock Gustav at cactus.dk
Tue Nov 2 11:30:58 CDT 2010


Hi Rocky

Yes. If you wish to display and enter percentage, you will have to enter percentage as 1.7 or 1.70, not 0.017.

/gustav


>>> rockysmolin at bchacc.com 02-11-2010 17:19:27 >>>
Gustav:

Changing to  dblNewVal = Val(NewData) / 100 and entering 0.017 gives .00017.
dblNewVal is too small by factor of 100 now.

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com 
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Tuesday, November 02, 2010 8:44 AM
To: accessd at databaseadvisors.com 
Subject: Re: [AccessD] Not In List Event

Hi Rocky

OK, that explains.
Now use this:

    dblNewVal = Val(NewData) / 100
    intReply = MsgBox("The value " & Format(dblNewVal, "Percent") & " is not in the " & Me.fldBaitPercent.Tag _
        & " percent list. Do you want to add it?", vbYesNo, "New Value")
    If intReply = vbNo Then
        Response = acDataErrContinue
        ' <NameOfYourComboBox>.Undo
    Else
        Set db = CurrentDb
        Set rs = db.OpenRecordset("Select Top 1 * FROM tblPercents")
        rs.AddNew
        rs!fldPercentType = Me.fldBaitPercent.Tag
        rs!fldPercentValue = dblNewVal
        rs.Update
        rs.Close
        Set rs = Nothing
        Me.fldBaitPercent = dblNewVal
        Response = acDataErrAdded
    End If

That works here.

/gustav


>>> rockysmolin at bchacc.com 02-11-2010 16:26:11 >>>
I changed the format of the combo box to Percent but when I enter 26 it
comes out as 2600% instead of 26%.  And gets stored in the table as 26
instead of .26

R





More information about the AccessD mailing list