VB command

A

Amateur

I have the following problem:
I run a command code to execute some commands, this command should run some
append and delete queries and at the end to open another form and to close
the existing form

Private Sub runclients_Click()
DoCmd.OpenQuery “contactsappendtoclientsâ€, acViewNormal, acEdit
DoCmd.OpenQuery “deleteclientsfromcontactsâ€, acViewNormal, acEdit
DoCmd.OpenQuery “billinghelpappendâ€, acViewNormal, acEdit
DoCmd.OpenForm “clientsâ€
DoCmd.Close “contactsâ€

The problem I have is with the last two lines. In the moment it’s only
working if I have either OpenForm “clients†OR Close – but it’s not working
if I have both lines together.
I do not receive any error message.
Is there anyone out there who can correct my code?
Thanks
Klaus
 
B

Brendan Reynolds

Amateur said:
I have the following problem:
I run a command code to execute some commands, this command should run
some
append and delete queries and at the end to open another form and to close
the existing form

Private Sub runclients_Click()
DoCmd.OpenQuery “contactsappendtoclientsâ€, acViewNormal, acEdit
DoCmd.OpenQuery “deleteclientsfromcontactsâ€, acViewNormal, acEdit
DoCmd.OpenQuery “billinghelpappendâ€, acViewNormal, acEdit
DoCmd.OpenForm “clientsâ€
DoCmd.Close “contactsâ€

The problem I have is with the last two lines. In the moment it’s only
working if I have either OpenForm “clients†OR Close – but it’s not
working
if I have both lines together.
I do not receive any error message.
Is there anyone out there who can correct my code?
Thanks
Klaus


The first argument to the Close method is the type of object to be closed,
not the name of the object. Try this ...

DoCmd.Close acForm, "contacts"
 

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