Connecting Tech Pros Worldwide Forums | Help | Site Map

'''''''''''''The Running Update/Append Queries Using VBA code Ordeal''''''''''''''

Aaron
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi,

Thanks for ur help there HJ.

I know how to do the tasks you specified there.

I would like for the update query to use field values from some of the
fields on the form (frmInvoices) such as InvoiceNumber, DateFrom,
DateTo. My problem is that an append/update query can't find the
values in the open Form (frmInvoices) when I specify them as;

[Forms]![frmInvoices]![InvoiceNumber]

a select query has no problem finding the field values on a form.

please help.

Aaron

HJ
Guest
 
Posts: n/a
#2: Nov 13 '05

re: '''''''''''''The Running Update/Append Queries Using VBA code Ordeal''''''''''''''


Hi Aaron,

Could you post the entire code that you are having trouble with? Now it is
not possible to see what goes wrong.

HJ

"Aaron" <aaron@rapid-motion.co.uk> wrote in message
news:260d7f40.0408120245.2f3d01f8@posting.google.c om...[color=blue]
> Hi,
>
> Thanks for ur help there HJ.
>
> I know how to do the tasks you specified there.
>
> I would like for the update query to use field values from some of the
> fields on the form (frmInvoices) such as InvoiceNumber, DateFrom,
> DateTo. My problem is that an append/update query can't find the
> values in the open Form (frmInvoices) when I specify them as;
>
> [Forms]![frmInvoices]![InvoiceNumber]
>
> a select query has no problem finding the field values on a form.
>
> please help.
>
> Aaron[/color]


Pieter Linden
Guest
 
Posts: n/a
#3: Nov 13 '05

re: '''''''''''''The Running Update/Append Queries Using VBA code Ordeal''''''''''''''


First off, if you are not always using all the parameters specified in
your form, then you have to add parameters to your query on the fly.
Also, you can't just do something like

qdf.SQL = "SELECT...blah blah blah"

and expect it to work without saving the sql.

I would just build the SQL on the fly and just do something like:

strsql = "UPDATE myTable SET [MyField] = '" & Me.strNewValue & "'
WHERE [myTable].[otherfield] = " & Me!SomeNumericValue

currentdb.execute strsql, dbfailonerror

then you can evaluate individual textboxes or whatever on your form
for empty/null and modify your SQL statement accordingly.
Closed Thread