Unsure why getting error

  • Thread starter Thread starter maceslin
  • Start date Start date
M

maceslin

In the following block of code I am getting an error for variable not
defined and I don't know why as there are no variables

If Forms![frmPara1]![cboCore] = "CNO" Then
strWhere = strWhere & " Core Capability= """ & CNO & """"
End If

The code may seem strange but it is the starting point to add several
other terms to the string such as CNA, CNE,etc...

Any idea why I am getting the above error

Thanks
Dave
 
Try...

strWhere = strWhere & " [Core Capability]= " & """ & Me.cboCore & """
or
strWhere = strWhere & " [Core Capability]= " & """ & Forms![frnPara1]!
[cboCore] & """

In the following block of code I am getting an error for variable not
defined and I don't know why as there are no variables

If Forms![frmPara1]![cboCore] = "CNO" Then
strWhere = strWhere & " Core Capability= """ & CNO & """"
End If

The code may seem strange but it is the starting point to add several
other terms to the string such as CNA, CNE,etc...

Any idea why I am getting the above error

Thanks
Dave
 
In the following block of code I am getting an error for variable not
defined and I don't know why as there are no variables

If Forms![frmPara1]![cboCore] = "CNO" Then
strWhere = strWhere & " Core Capability= """ & CNO & """"
End If

The code may seem strange but it is the starting point to add several
other terms to the string such as CNA, CNE,etc...

Any idea why I am getting the above error

Thanks
Dave
Dave, have you a dim statement for strWhere?

Luck,
Jonathan
 
In the following block of code I am getting an error for variable not
defined and I don't know why as there are no variables
If Forms![frmPara1]![cboCore] = "CNO" Then
            strWhere = strWhere & " Core Capability= """& CNO & """"
End If
The code may seem strange but it is the starting point to add several
other terms to the string such as CNA, CNE,etc...
Any idea why I am getting the above error
Thanks
Dave

Dave, have you a dim statement for strWhere?

Luck,
Jonathan- Hide quoted text -

- Show quoted text -


strWhere is defined as a variable, Can not use Accessvandals
suggestions as I will be adding terms to have the code read Core
Capability - "CNO or CNA or CNE or CND"
 
Dave,

strWhere = strWhere & " Core Capability= """ & CNO & """"

Is CNO a variable? Is the error on this line?

[quoted text clipped - 18 lines]
 
Dave,

strWhere = strWhere & " Core Capability= """ & CNO & """"

Is CNO a variable? Is the error on this line?

:
In the following block of code I am getting an error for variable not
[quoted text clipped - 18 lines]

Tried as suggested but get syntax error ( missing operator) in query
expression
'Core capability= "CNO'"

In locals window am getting
strWhere "Where Core Capability= "CNO""
 
Dave,

You'll have to include the square brackets whenever you have a space between
a field, example..
[Core Capability] = 'CNO'".

strWhere = "Where [Core Capability]= 'CNO'"

Use the single quote between the string CNO instead of double quotes.
 
Dave,

You'll have to include the square brackets whenever you have a space between
a field, example..
[Core Capability] = 'CNO'".

strWhere = "Where [Core Capability]= 'CNO'"

Use the single quote between the string CNO instead of double quotes.

Tried as suggested but get syntax error ( missing operator) in query
expression
'Core capability= "CNO'"
In locals window am getting
strWhere      "Where Core Capability= "CNO""

Thanks
your square brackets caught me and had me look at name it is
CoreCapability with no space, tghe follwing line of code works:
strWhere = strWhere & " CoreCapability=""" & "CNO" & """"

THanks, next I will add the other criteria

Dave
 
Back
Top