SachAccess
Active member
- Local time
- Today, 17:16
- Joined
- Nov 22, 2021
- Messages
- 405
Hi,
I am referring below code. Have changed original values to dummy values.
As per my understanding below code is assigning value to Dummy based on the Case.
If Case if less than 25 then Dummy = ABC in this manner. Please correct me if am wrong.
I was thinking, is it possible to change hard-coded ABC to dynamic input. For example, if I have these ABC, BCD stored in a mapping table.
Can I pass values from the table instead of hard-coded string in the code itself. Kindly pardon my ignorance.
I am referring below code. Have changed original values to dummy values.
As per my understanding below code is assigning value to Dummy based on the Case.
If Case if less than 25 then Dummy = ABC in this manner. Please correct me if am wrong.
I was thinking, is it possible to change hard-coded ABC to dynamic input. For example, if I have these ABC, BCD stored in a mapping table.
Can I pass values from the table instead of hard-coded string in the code itself. Kindly pardon my ignorance.
Code:
Option Compare Database
Public Function Dummy(MyIdYourId As Integer) As String
On Error GoTo Err_Dummy
Select Case MyIdYourId
Case Is < 25
Dummy = "ABC"
Case 50
Dummy = "BCD"
Case 75
Dummy = "CDE"
Case 100
Dummy = "EFG"
Case Else
Dummy = "FGH"
End Select
Exit_Dummy:
Exit Function
Err_Dummy:
MsgBox "Error #" & Err.Number & " - " & Err.Description, vbCritical, "An Error has occurred"
Resume Exit_Dummy
End Function