![]() |
parameter problem
hi all,
having a bit of trouble with a function MsgBox DepositIntoInventory(ManageInventory.DepositLot, ManageInventory.DepositCases, ManageInventory.DepositMonth), vbOKOnly, "Alert" is the call and i'm getting a type mismatch error Public Function DepositIntoInventory(lotNum As ComboBox, numCases As TextBox, monthName As ComboBox) As String DepositIntoInventory = "Deposit of " & numCases.Caption & " cases of lot " & lotNum.Value & " in " & monthName.Value & " was successful." End Function all the types are correct, DepositLot is a combobox, DepositCases is a TextBox, DepositMonth is a ComboBox if i change the types to string in the definition of the function, and remove the qualifiers - then it works ok. can anyone help explain why? tia J |
parameter problem
Change your argument type declarations to MSForms.ComboBox and MSForms.TextBox. Without the MSForms prefix VBA thinks you are referring to the Excel drawing objects of those names. -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm "Gixxer_J_97" wrote in message ... hi all, having a bit of trouble with a function MsgBox DepositIntoInventory(ManageInventory.DepositLot, ManageInventory.DepositCases, ManageInventory.DepositMonth), vbOKOnly, "Alert" is the call and i'm getting a type mismatch error Public Function DepositIntoInventory(lotNum As ComboBox, numCases As TextBox, monthName As ComboBox) As String DepositIntoInventory = "Deposit of " & numCases.Caption & " cases of lot " & lotNum.Value & " in " & monthName.Value & " was successful." End Function all the types are correct, DepositLot is a combobox, DepositCases is a TextBox, DepositMonth is a ComboBox if i change the types to string in the definition of the function, and remove the qualifiers - then it works ok. can anyone help explain why? tia J |
parameter problem
What is ManageInventory? And also, why are you using numcases.caption and
not numcases.value? "Gixxer_J_97" wrote: hi all, having a bit of trouble with a function MsgBox DepositIntoInventory(ManageInventory.DepositLot, ManageInventory.DepositCases, ManageInventory.DepositMonth), vbOKOnly, "Alert" is the call and i'm getting a type mismatch error Public Function DepositIntoInventory(lotNum As ComboBox, numCases As TextBox, monthName As ComboBox) As String DepositIntoInventory = "Deposit of " & numCases.Caption & " cases of lot " & lotNum.Value & " in " & monthName.Value & " was successful." End Function all the types are correct, DepositLot is a combobox, DepositCases is a TextBox, DepositMonth is a ComboBox if i change the types to string in the definition of the function, and remove the qualifiers - then it works ok. can anyone help explain why? tia J |
parameter problem
Thanks Rob!
ManageInventory is my userform - numcases.caption was a typo on my part. "K Dales" wrote: What is ManageInventory? And also, why are you using numcases.caption and not numcases.value? "Gixxer_J_97" wrote: hi all, having a bit of trouble with a function MsgBox DepositIntoInventory(ManageInventory.DepositLot, ManageInventory.DepositCases, ManageInventory.DepositMonth), vbOKOnly, "Alert" is the call and i'm getting a type mismatch error Public Function DepositIntoInventory(lotNum As ComboBox, numCases As TextBox, monthName As ComboBox) As String DepositIntoInventory = "Deposit of " & numCases.Caption & " cases of lot " & lotNum.Value & " in " & monthName.Value & " was successful." End Function all the types are correct, DepositLot is a combobox, DepositCases is a TextBox, DepositMonth is a ComboBox if i change the types to string in the definition of the function, and remove the qualifiers - then it works ok. can anyone help explain why? tia J |
All times are GMT +1. The time now is 12:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com