data type for parameter

  • Thread starter Thread starter richaluft
  • Start date Start date
R

richaluft

Hi:
Can someone tell me what datatype a query parameter should have to
enable a parameter value of "X" or " " (as in null)? "Text" datatype
doesn't want to work.
Richard
 
Hi

I am lost on this. Are you wanting to find a field that either contains an
"X" or the field is null? You could try something like this. Or are you
wanting to prompt for criteria?

SELECT TableName.FieldName
FROM TableName.FieldName
WHERE ((( TableName.FieldName) Like "X" Or ( TableName.FieldName) Is Null));
 
Hi

I am lost on this. Are you wanting to find a field that either contains an
"X" or the field is null? You could try something like this. Or are you
wanting to prompt for criteria?

SELECT TableName.FieldName
FROM TableName.FieldName
WHERE ((( TableName.FieldName) Like "X" Or ( TableName.FieldName) Is Null));

Wayne;
You just made me realize that I'm probably misusing a parameter
query. I'm trying to open a query, but at the same time enter values
for certain fields in my code. I'll clearly have to use a different
route for accomplishing this.
Richard
 
Hi

I am lost on this. Are you wanting to find a field that either contains an
"X" or the field is null? You could try something like this. Or are you
wanting to prompt for criteria?

SELECT TableName.FieldName
FROM TableName.FieldName
WHERE ((( TableName.FieldName) Like "X" Or ( TableName.FieldName) Is Null));

Wayne;
What I wanted to do was to create code for an update query, where I
was inserting my query values into a table, and, at the same time,
adding additional values for fields present in the table, but not
present in the query. After your comment,I'm not sure if there is any
way for this to be effected. Perhaps I have to use coding with addnew
for the whole data line?
Richard
 
OpenRecordset with AddNew and Update would work.

Unless you need to loop to assign some values, it might be easier to just
build the Append query statement as a string (concatening values into it),
and Execute. Here's an example showing how to build and execute such a
string:
http://allenbrowne.com/ser-60.html

If the string is long/complex, you can mock one up in the query window, and
copy'n'paste into your VBA code. This might help:
Copy SQL statement from query to VBA
at:
http://allenbrowne.com/ser-71.html

I understand that your original question no longer stands, but in general, a
parameter needs the same data type as the field it will be applied against.
And if you do use a Text parameter, and the parameter refers to a text box
on a form, JET won't handle it correctly when the text box is null:
Parameter of type Text is evaluated wrongly
at:
http://allenbrowne.com/bug-13.html
 
Back
Top