Constant Error (1 Viewer)

Alhakeem1977

Registered User.
Local time
Today, 22:30
Joined
Jun 24, 2017
Messages
308
Hi All,

How can I fix the below error (Constant expression required)? As I want to get the value string column 1 from combobox.

Const error.PNG


Thanks in advance!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:30
Joined
Oct 29, 2018
Messages
21,358
Interesting. You still use an A: drive? Do you, by any chance, have any missing references? Just curious...
 

Alhakeem1977

Registered User.
Local time
Today, 22:30
Joined
Jun 24, 2017
Messages
308
Interesting. You still use an A: drive? Do you, by any chance, have any missing references? Just curious...

Thanks for your earliest response.
:) This is another project, also I must use a centralized shared folder for another purpose.
I have checked the References there is no missing.
 

Alhakeem1977

Registered User.
Local time
Today, 22:30
Joined
Jun 24, 2017
Messages
308
Sorry it must be without the full path but I got a syntax error

Code:
Const strXFDF As String = " & Me.cboForm.Column(1) & ".xfdf"
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:30
Joined
Oct 29, 2018
Messages
21,358
Sorry it must be without the full path but I got a syntax error

Code:
Const strXFDF As String = " & Me.cboForm.Column(1) & ".xfdf"
What do you get with this?
Code:
Debug.Print Me.cboForm.Column(1)
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:30
Joined
Oct 29, 2018
Messages
21,358
Hmm, no, I mean, just enter that line by itself. Anyway, since you want to use a variable, you can't use a constant. So, try changing your code to this:
Rich (BB code):
'Declare the XFDF file to use
Dim strXFDF As String
strXFDF = Me.cboForm.Column(1) & ".xfdf"
Hope that helps...
 

Alhakeem1977

Registered User.
Local time
Today, 22:30
Joined
Jun 24, 2017
Messages
308
Hmm, no, I mean, just enter that line by itself. Anyway, since you want to use a variable, you can't use a constant. So, try changing your code to this:
Rich (BB code):
'Declare the XFDF file to use
Dim strXFDF As String
strXFDF = Me.cboForm.Column(1) & ".xfdf"
Hope that helps...

It works fine with no error.

Thank you so much! :love:
 

Users who are viewing this thread

Top Bottom