Re: Debit Card Purchase recording

From: Dirk Goldgar (dg_at_NOdataSPAMgnostics.com)
Date: 11/13/04

  • Next message: Niklas Östergren: "Re: Format a textcontrol!"
    Date: Sat, 13 Nov 2004 01:52:09 -0500
    
    

    Comments inline ...

    "Jan Il" <abuse@localhost.com> wrote in message
    news:utf6IOTyEHA.2036@TK2MSFTNGP12.phx.gbl
    >
    > 'k.....here is the code that I have put into the Form module of the
    > test app. for
    > the above portion of the code. The table field is CheckNo. I have
    > the table field set to data type Text, and No Duplicates:
    >
    > Private Function NextDBTNumber() As String
    >
    > ' This function finds the highest "DBT" check number currently on
    > ' file and adds 1 to it to get a new DBT number.
    >
    > Dim strMaxNum As String
    >
    > strMaxNum = vbNullString & _
    > DMax(CheckNo", "CheckRegister", _
    > CheckNo Like 'DBT*'")

    ***
    Jan, there are a couple of missing quotes there. That last statement
    should be:

         strMaxNum = vbNullString & _
                 DMax("CheckNo", "CheckRegister", _
                             "CheckNo Like 'DBT*'")

    I trust the table really is named "CheckRegister"? Otherwise you should
    change that, too.
    ***

    >
    > If Len(strMaxNum) = 0 Then
    > NextDBTNumber = "DBT000001"
    > Else
    > NextDBTNumber = _
    > "DBT" & Format(1 + CLng(Mid(strMaxNum, 4)), "000000")
    > End If
    >
    > End Function
    >>
    >
    >
    > And..... for this part of the Code:
    >
    >> Private Sub CheckNumber_AfterUpdate()
    >>
    >> With Me!CheckNumber
    >> If .Value = "DBT" _
    >> And IsNull(.OldValue) _
    >> Then
    >> .Value = NextDBTNumber()
    >> End If
    >> End With
    >>
    >> End Sub
    >
    > I have this in the After Update Event of the control in the form
    > which is txtCheckNo:
    >
    > Private Sub txtCheckNo_AfterUpdate()
    >
    > With Me!txtCheckNo
    > If .Value = "DBT" _
    > And IsNull(.OldValue) _
    > Then
    > .Value = NextDBTNumber()
    > End If
    >
    > End With
    >
    > End Sub

    ***
    That looks okay, despite the error message you're getting.
    ***

    > When I entered a check number in the txtCheckNo control on the entry
    > form (1001) and hit tab to go to the date control, it fired this
    > error message:
    >
    > The expression After Update you have entered as the event property
    > setting produced the following error: Ambiguous name detected:
    > txtCheckNo_After Update.
    >
    > * This expression may not result in the name of a macro, the name of a
    > user-defined function, or [Event Procedure].
    > * There may been an error evaluating the function, event or macro.
    >
    > I double checked and the control name and table field names are
    > correct. I also got this same error when I entered the DBT and
    > tried to move to the next control. Have I missed something somewhere
    > or overlooked something in the Code?
    >
    > Also, the debugger balks at this part of the code in the After Update
    > Event for the txtCheckNo control: Private Sub txtCheckNo_AfterUpdate()
    >
    > And the error message is:
    >
    > Ambiguous name detected: txtCheckNo_AfterUpdate()

    What that message is telling you is that you have two (or more)
    procedures named "txtCheckNo_AfterUpdate" in your form's module, so
    Access doesn't know which one to call when the AfterUpdate event fires.
    Probably, in the course of working at this problem, you created another
    AfterUpdate event procedure for this control. Look through the form's
    module for the other procedure and delete it if there's nothing in it
    that you need to keep. If, on the other hand, there is code in that
    other procedure that you still want to have execute when CheckNo is
    updated, copy that code into the new txtCheckNo_AfterUpdate() procedure
    before deleting the old one.

    -- 
    Dirk Goldgar, MS Access MVP
    www.datagnostics.com
    (please reply to the newsgroup)
    

  • Next message: Niklas Östergren: "Re: Format a textcontrol!"

    Relevant Pages

    • Re: NTSVC.OCX Help needed
      ... "When you use the Services snap-in to start a local service on a Microsoft ... The "cause" is stated as "This arbitrary time limit had been set with the ... error message and continue to check for the service to start. ... you must check the System event log for Service Control ...
      (microsoft.public.vb.general.discussion)
    • Re: After Update code requires amendment
      ... 'Test for null value in Combo28 ... > Private Sub Form_Current ... > ' Find the record that matches the control. ... but I would rather disable the error message in that instance. ...
      (microsoft.public.access.gettingstarted)
    • Microphone wont work
      ... Control Panel/Sounds and Audio Device/Voice/Testing sound Hardware. ... Windows error message "Windows cannot execute DpvSetup.exe, ... Sounds And Audio Devices icon (in the Sounds, Speech, And Audio Devices ... Now it's time to edit the Registry. ...
      (microsoft.public.windowsxp.hardware)
    • Re: Error 2501 Problem when DoubleClicking to Delete Record is Can
      ... >> <MS ACCESS MVP> ... >>> Private Sub DeleteRecord_DblClick ... >>> ' show the error message. ... >>> about whether or not i want to continue (following the msgBox message ...
      (microsoft.public.access.formscoding)
    • Re: Help to fix error message accessing Help Center
      ... What happens if you reset the Internet Options Security settings back to ... Open the Internet Options in the Control Panel, ... And, yes, the error message was EXACTLY as shown on your web page. ...
      (microsoft.public.windowsxp.help_and_support)

    Loading