Hi:
I'm running into an overflow problem with the following code (with the variable nCNOS), but get a compile error (AddInvoice rsInvoice, nRNOS, nCNOS) if I change it to Long. Can someone help?
I'm running into an overflow problem with the following code (with the variable nCNOS), but get a compile error (AddInvoice rsInvoice, nRNOS, nCNOS) if I change it to Long. Can someone help?
Code:
Dim stDocName As String Dim nRetreatNumber As Integer Dim nRNOS As Integer 'Dim nCNOS As Integer Dim nCNOS As Long 'check whether there is a customer number nRNOS = Forms!frmSpecialEventsEnterDeleteModify.RNOS nCNOS = Forms!frmSpecialEventsEnterDeleteModify.Text191 Dim Msg, Style, Title, Help, Ctxt, Response, MyString If IsNull(nCNOS) Or nCNOS = 0 Then Msg = "You must select a person to bill before you can create an invoice" Style = vbOK + vbCritical Title = "Select a person to bill" MsgBox Msg, Style, Title Exit Sub End If Dim sWhere As String Dim rsInvoice As ADODB.Recordset Dim rsCount As ADODB.Recordset nRNOS = Forms!frmSpecialEventsEnterDeleteModify.[RNOS] Set rsCount = New ADODB.Recordset Set rsInvoice = New ADODB.Recordset sWhere = "SELECT * FROM tblInvoice WHERE RNOS = " & nRNOS & "" rsCount.Open sWhere, CurrentProject.Connection, adOpenDynamic, adLockOptimistic 'check if an invoice already exists for this event If rsCount.EOF Then rsInvoice.Open "tblInvoice", CurrentProject.Connection, adOpenDynamic, adLockOptimistic AddInvoice rsInvoice, nRNOS, nCNOS rsInvoice.Close stDocName = "rptInvoiceForSpecialEvents" DoCmd.OpenReport stDocName, acPreview Else stDocName = "rptInvoiceForSpecialEvents" DoCmd.OpenReport stDocName, acViewPreview End If
Comment