Home > Forum Home > Excel Invoice Template > Error On Customer_Invoicing.xls Share

Error On Customer_Invoicing.xls

Excel Help for Error On Customer_invoicing.xls in Excel Invoice Template


Forum TopicPost Reply Login

Error On Customer_invoicing.xls

Rate this:
(3/5 from 1 vote)
Confused Dear Sir,
Please be aware that there is a problem with your code for the workbook called: Customer_Invoicing.xls.
When clicking OK on the form “LoadCustomer”, the function “LoadCust” is called as follows with the variable “custid” that is of “string” type.:
VBA Code:
Private Sub OK_Click()
Application.ScreenUpdating = False
Dim custid As String
protection.Unprotectit
If customer.ListIndex <> -1 Then
custid = customer.Value
If custid <> "" Then
custid = Left(custid, InStr(1, custid, ".") - 1)
End If
Common.LoadCust (custid)
End If
Sheets("Invoice").Select
protection.Protectit
Unload Me
Application.ScreenUpdating = True
End Sub

Therefore variable in the definition of the function “LoadCust” in the module “Common” should be a “string” and NOT a “single”. I propose the following corrections:
 
VBA Code:
Function LoadCust(cust As Single As String)
………
………
If cust > 0 Then cust <> “” then
Sheets("Invoice").Select
………
………
End If
If custno > 0 Then
Sheets("Invoice").Select
Range("custname").Select
ActiveCell.Formula = custname
ActiveCell.Offset(0, 9).Formula = custno
ActiveCell.Offset(1, 0).Formula = compname
ActiveCell.Offset(2, 0).Formula = street
ActiveCell.Offset(3, 0).Formula = city
ActiveCell.Offset(4, 0).Formula = country
ActiveCell.Offset(5, 0).Formula = "Phone/Fax: " & phone
ActiveCell.Offset(6, 0).Formula = "Email: " & email
End If
End Function

Thank you and best regards,

Ankady
 Posted by on
 
Replies - Displaying 1 to 2 of 2Order Replies By: Most Recent | Chronological | Highest Rated
Applaud
Rate this:
(3/5 from 1 vote)
Thank you for this report. Indeed there is a variable type mismatch in the code for the customer ID.  We will look into resolving this; however it does not produce an error as the ID text is interpreted as a number when passed to the loading function.
 Excel Business Forums Administrator
 Posted by on
Confused
Rate this:
(4/5 from 2 votes)
No worries mate! It actually created  a type mistamtch error all the times especially if the custommer ID is not a number (e.g., AMX03).
 Posted by on
 Displaying page 1 of 1 

Find relevant Excel templates and add-ins for Error On Customer_Invoicing.xls in the