Re: Debit Card Purchase recording
From: Dirk Goldgar (dg_at_NOdataSPAMgnostics.com)
Date: 11/13/04
- Previous message: Dirk Goldgar: "Re: Debit Card Purchase recording [OT]"
- In reply to: Jan Il: "Re: Debit Card Purchase recording"
- Next in thread: Jan Il: "Re: Debit Card Purchase recording"
- Reply: Jan Il: "Re: Debit Card Purchase recording"
- Messages sorted by: [ date ] [ thread ]
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)
- Previous message: Dirk Goldgar: "Re: Debit Card Purchase recording [OT]"
- In reply to: Jan Il: "Re: Debit Card Purchase recording"
- Next in thread: Jan Il: "Re: Debit Card Purchase recording"
- Reply: Jan Il: "Re: Debit Card Purchase recording"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|