C
Chris Strug
Hi,
I have a list of names associated with character string abbreieviations.
For example:
....
rff_GoodsDeclarationNumber = "AEE"
rff_ConsigneesShipmentReferenceNumber = "AAO"
rff_CarriersAgentReferenceNumber = "AAY"
rff_CustomsDeclarationNumber = "ABT"
rff_VehicleLicenceNumber = "ABZ"
rff_AdditionalReferenceNumber = "ACD"
rff_TransportContractReferenceNumber = "AHI"
rff_ContainerPrefix = "AKB"
rff_VehicleIdentificationNumber = "AKG"
rff_TransportCostsReferenceNumber = "AKW"
rff_PersonalIdentityCardNumber = "ARJ"
rff_FlatRackContainerBundleIdentificationNumber = "ATW"
rff_PlaceOfPositioningReference = "AUA"
rff_BillOfLadingNumber = "BM"
rff_BookingReferenceNumber = "BN"
rff_BlockstowReference = "BST"
rff_BatchLotNumber = "BT"
rff_CarriersReferenceNumber = "CN"
....
Now, what I want to be able to do is create a enumerated datatype restricted
to the above values that I can use when creating a datatype or argument.
For example, assuming that I create the above as "ReferenceQualifier"
dim Ref as ReferenceQualifier.
Ref is now restricted to the values above. If I assign one of the constant
names to Ref, it returns the string code associated with it.
E.g.
ref = rff_BillOfLadingNumber
msgbox Ref
Outputs 'BM'
I realise that this is more of a Vb than Access question but ask you to take
pity on me!
I have tried creating an enum as follows:
public enum ReferenceQualifier
rff_TransportContractReferenceNumber = "AHI"
rff_ContainerPrefix = "AKB"
rff_VehicleIdentificationNumber = "AKG"
rff_TransportCostsReferenceNumber = "AKW"
rff_PersonalIdentityCardNumber = "ARJ"
rff_FlatRackContainerBundleIdentificationNumber = "ATW"
rff_PlaceOfPositioningReference = "AUA"
rff_BillOfLadingNumber = "BM"
rff_BookingReferenceNumber = "BN"
rff_BlockstowReference = "BST"
end enum
But I receive the error message "Compile Error, Type Mismatch" on the first
line of the enum declaration when I try to run the code...
Is enum the right approach here?
Any and all advice is gratefully received.
Thanks
Chris,
I have a list of names associated with character string abbreieviations.
For example:
....
rff_GoodsDeclarationNumber = "AEE"
rff_ConsigneesShipmentReferenceNumber = "AAO"
rff_CarriersAgentReferenceNumber = "AAY"
rff_CustomsDeclarationNumber = "ABT"
rff_VehicleLicenceNumber = "ABZ"
rff_AdditionalReferenceNumber = "ACD"
rff_TransportContractReferenceNumber = "AHI"
rff_ContainerPrefix = "AKB"
rff_VehicleIdentificationNumber = "AKG"
rff_TransportCostsReferenceNumber = "AKW"
rff_PersonalIdentityCardNumber = "ARJ"
rff_FlatRackContainerBundleIdentificationNumber = "ATW"
rff_PlaceOfPositioningReference = "AUA"
rff_BillOfLadingNumber = "BM"
rff_BookingReferenceNumber = "BN"
rff_BlockstowReference = "BST"
rff_BatchLotNumber = "BT"
rff_CarriersReferenceNumber = "CN"
....
Now, what I want to be able to do is create a enumerated datatype restricted
to the above values that I can use when creating a datatype or argument.
For example, assuming that I create the above as "ReferenceQualifier"
dim Ref as ReferenceQualifier.
Ref is now restricted to the values above. If I assign one of the constant
names to Ref, it returns the string code associated with it.
E.g.
ref = rff_BillOfLadingNumber
msgbox Ref
Outputs 'BM'
I realise that this is more of a Vb than Access question but ask you to take
pity on me!
I have tried creating an enum as follows:
public enum ReferenceQualifier
rff_TransportContractReferenceNumber = "AHI"
rff_ContainerPrefix = "AKB"
rff_VehicleIdentificationNumber = "AKG"
rff_TransportCostsReferenceNumber = "AKW"
rff_PersonalIdentityCardNumber = "ARJ"
rff_FlatRackContainerBundleIdentificationNumber = "ATW"
rff_PlaceOfPositioningReference = "AUA"
rff_BillOfLadingNumber = "BM"
rff_BookingReferenceNumber = "BN"
rff_BlockstowReference = "BST"
end enum
But I receive the error message "Compile Error, Type Mismatch" on the first
line of the enum declaration when I try to run the code...
Is enum the right approach here?
Any and all advice is gratefully received.
Thanks
Chris,