
Signature
Wayne
Manchester, England.
On Jan 23, 4:25 pm, Wayne-I-M <Wayn...@discussions.microsoft.com>
wrote:
> Hi
>
[quoted text clipped - 16 lines]
> > doesn't want to work.
> > Richard
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
On Jan 23, 4:25 pm, Wayne-I-M <Wayn...@discussions.microsoft.com>
wrote:
> Hi
>
[quoted text clipped - 16 lines]
> > doesn't want to work.
> > Richard
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
Allen Browne - 24 Jan 2008 01:59 GMT
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

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
> 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,
[quoted text clipped - 3 lines]
> for the whole data line?
> Richard