VB command

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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"
 
Back
Top