NextJournalNumber = Right("00000" + Trim(str(Val(srec) + 1)), 5)
Should be
NextJournalNumber = Right("00000" & Trim(str(Val(srec) + 1)), 5)
You can't add strings only numbers
Hal McGee
Engineering Data Manager
Group Engineering - Process and Compliance
Seating Products Group
B/E Aerospace
Winston-Salem, NC
Mylz Kitufu
<[EMAIL PROTECTED]
uk> To
Sent by: [email protected]
AccessDevelopers@ cc
yahoogroups.com
Subject
[AccessDevelopers] Type Mismatch
12/02/2005 08:22 error
AM
Please respond to
AccessDevelopers@
yahoogroups.com
When I run the code below, I get the TYPE MISMATCH ERROR when I run
?NextJournalNumber In the immediate window.
It doesn't matter whether I use nextjournalnumber() as string.
What Am I doing wrong? Am running Access 2000 adp / mssql7.
Godfrey
CODE Follows------------------------------------------------------->
Function NextJournalNumber()
Dim sql, srec As String
Dim rst As New ADODB.Recordset
srec = "00000"
sql = "select cast(strmrefno as money) as SrefNo from gl_trans_hdr where
t_VCHRtype='I' and len(strmrefno)=5 order by cast(strmrefno as money)desc"
rst.Open sql, CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rst.RecordCount > 0 Then
rst.MoveFirst
If rst!SrefNo > Val(srec) Then
srec = str(rst!SrefNo)
End If
End If
rst.Close
NextJournalNumber = Right("00000" + Trim(str(Val(srec) + 1)), 5)
End Function
---------------------------------------------------------------------------------->
In the end, we will remember not the words of our enemies,
but the silence of our friends - Martin Luther King Jr.
---------------------------------------------------------------------------------->
___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with
voicemail http://uk.messenger.yahoo.com
Please zip all files prior to uploading to Files section.
YAHOO! GROUPS LINKS
Visit your group "AccessDevelopers" on the web.
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/2jUsvC/tzNLAA/TtwFAA/q7folB/TM
--------------------------------------------------------------------~->
Please zip all files prior to uploading to Files section.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AccessDevelopers/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/