I have this Function where i get a 3075 run time error. It is on this line of code, i will post rest afterwards. I have a sub-form which has 3 boxes to choose either option to get back data on the form (Brand,Generic,Manufacturer). I take it something is wrong with getting back data to form with my IF statements but not sure how to rephrase it.
Error line is this in debug mode - Me.tbl_Drug_Master_Date_subform.Form.RecordSource = task
Error message states: Syntax error(missing operator) in query expression l2.insert(0, 8)
Full code:
'[Brand]=Idaloprine'And[Generic] like '*'And[Manufacturer] like '*'
答案 0 :(得分:1)
Error message states: Syntax error(missing operator) in query expression
"+"
As the message says, your query expression is broken. The single quotes '[Brand]=Idaloprine'And[Generic] like '*'And[Manufacturer] like '*'
are used to enclose string literals. Thus, '
is a string literal, not a comparison. What you probably wanted to write was '[Brand] = Idaloprine'
. This is a comparison ([Brand] = 'Idaloprine'
) between a field (=
) and a string literal ([Brand]
).
Thus, your goal is to modify your code such that your query expression reads
'Idaloprine'
Modifying your code to achieve that is left as an exercise.
答案 1 :(得分:1)
Two problems. First of all, your quotes aren't matching:
this.logForm = function(isValid) {
if (isValid) {
var usercredentials = {type:"resultmessage", name: this.credentials.username, encpwd: this.credentials.password };
$http({ method: 'POST', url: '/login1', usercredentials })
.then(
function successCallback(response, $cookies) {
// this callback will be called asynchronously when the response is available
if(response.data.content=='login1success'){// do some stuff
} else {// do other stuff
}
},
function errorCallback(response, status) {// is status a valid parameter to place here to get the error code?
// called asynchronously if an error occurs or server returns response with an error status.
if(status == 403){
this.clearCookies();
// try to call this POST method again, but how? And how avoid infinite loop?
}
}
);
}
};
You're missing a single quote at the beginning of cboBrand. So, if cboBrand = "Coke", what you have will produce:
Brandtype = "[BRAND] = " & Me.cboBrand & "'"
Notice the missing opening single-quote? Replace them with something like this:
Brandtype = "[BRAND] = Coke'"
Second problem; spacing. Here's your code:
Brandtype = "[BRAND] = '" & Me.cboBrand & "'"
You need spaces, or it will all be interpreted as one long word. Try this:
strCriteria = Brandtype & "And" & strGeneric & "And" & strManufacturer