Reputation: 37
Function CC1(BP As short, CC As short) As String
If BP = 1 Then
cc = "B*"
Else
cc = "C*"
End If
End Function
I tried to call the above function in access query, but if says compile error
Access query has this function in below format
n: CC1([BP],[CC])
Upvotes: 1
Views: 65
Reputation: 12353
Byte is suitable for your function defined
SELECT CC1([BP],[CC]) as n
Function CC1(BP As Byte, CC As Byte) As String
If BP = 1 Then
CC1 = "B*"
Else
CC1 = "C*"
End If
End Function
Note:
CC As Byte
is not used.Upvotes: 0
Reputation: 84465
As mentioned Short doesn't exist.
Declare as Long which can easily cater for signed 16-bit (2-byte) integers that range in value from -32,768 through 32,767.
Why Long? See the lengthy discussion here: Why Use Integer Instead of Long?
Upvotes: 1
Reputation: 27644
VBA doesn't have a data type short
.
https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/data-type-summary
Upvotes: 2