setting values to "0"

A

Amateur

Dear Sirs
- I have a table named "clientspool"
- I have a field in this table called "eurodeposit"
- I have a form with a command button NOT based on that table, which is
executing already some tasks.

This is the code for the button until now:
Private Sub Command20_Click()
Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE""
""C:\cps208\writeinvoices.mdb"" /X invoicenumbersdelete", 0)
Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE""
""C:\cps208\trading.mdb"" /X endofday2", 0)
Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE""
""C:\cps208\trading.mdb"" /X endofmonth", 0)
Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE""
""C:\cps208\trading.mdb"" /X endofday2", 0)
End Sub

I know if the form would based on that table I would have to write the
command button like this:
Private Sub cmdZeroDeposit_Click()
Me!Eurodeposit = 0
End Sub

But the form I am using is NOT based on that table - so -
I would like that this command button as well sets my table values for the
field "eurodeposit" to "0" - so, somehow I have to tell that the field
"eurodeposit" in the table "clientspool" = 0 when I click the button
(something like
Me!clientspool.eurodeposit = 0).
Can you help?
Thanks very much
Klaus
 
P

Pieter Wijnen

how about

Currentdb.execute "UPDATE ClientSpool SET EuroDeposit=0", DaO.dbFailOnError

or

Currentdb.execute "UPDATE ClientSpool IN 'C:\cps208\trading.mdb' SET
EuroDeposit=0", DaO.dbFailOnError

By the way, why don't you create another macro in C:\cps208\trading.mdb
that calls all the relevant macro's instead of
one by one, the way you do it there's no certainity that one is finnished
before you kick of the next.

Pieter
 
A

Amateur

Thanks Peter, your first solution helped.
BUT - one more question:
The solution: Currentdb.execute "UPDATE ClientSpool SET EuroDeposit=0",
DaO.dbFailOnError - helped to put the field value to "0".
Now I have a problem with "checkboxes".
I would like that a checkbox called "monthinvoices" " from the table called
"invoicetrading" in the DB called "writeinvoices.mdb" are unchecked
automatically if I click the same command button as before for the
"field-to-0-setting".
Please keep in mind that the table with the checkbox is in another DB as the
Form with the command button.
(Maybe something like this: writeinvoices.mdb.execute "UPDATE invoicetrading
SET monthinvoices = False")

Can you help?
Thanks
Klaus
 
P

Pieter Wijnen

yes, but you can use 0 instead of false (false=0, true=-1)
You must either open a connection to the remote db:
Dim Db AS DAO.Database
set Db = OpenDatabase("MyremoteDb")
or
use the IN '..' Syntax to do it from the CurrentDb, as outlined in my
alternate approach

Pieter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top