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


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/I258zB/QnQLAA/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/
 


Reply via email to