I have taken the liberty of translating the vb from Dutch to English (this helps as often people name things hinting at what they plan to do)
Code:
Function Macro_add_new_patient()
On Error GoTo Macro_add_new_patient_Err
DoCmd.SetWarnings False
' add new patient
DoCmd.OpenQuery "Query add new patient", acViewNormal, acEdit
' calculate waiting
DoCmd.OpenQuery "Query calculate waiting", acViewNormal, acEdit
' Add highest patient number to table appointment
DoCmd.OpenQuery "Query Add highest patient number to table appointment", acViewNormal, acEdit
' Add a new patient appointment
DoCmd.OpenQuery "Query Add a new patient appointment", acViewNormal, acEdit
' DoCmd.Requery "Form new patient appointment"
Forms![Form new patient appointment].Form!Requery
Macro_add_new_patient_Exit:
Exit Function
Macro_add_new_patient_Err:
MsgBox Error$
Resume Macro_add_new_patient_Exit
End Function
You are almost, and I suspect working code should be below...
Code:
Function Macro_add_new_patient()
On Error GoTo Macro_add_new_patient_Err
DoCmd.SetWarnings False
' add new patient
DoCmd.OpenQuery "Query add new patient", acViewNormal, acEdit
' calculate waiting
DoCmd.OpenQuery "Query calculate waiting", acViewNormal, acEdit
' Add highest patient number to table appointment
DoCmd.OpenQuery "Query Add highest patient number to table appointment", acViewNormal, acEdit
' Add a new patient appointment
DoCmd.OpenQuery "Query Add a new patient appointment", acViewNormal, acEdit
' requery statement
[Forms]![Form new patient appointment].Requery
Macro_add_new_patient_Exit:
Exit Function
Macro_add_new_patient_Err:
MsgBox Error$
Resume Macro_add_new_patient_Exit
End Function
Sorry but I am too lazy to translate it back to Dutch, but you should be able to get the idea.
Like I said in your previous post regarding this you are likely to be better off binding it to the form control direct in VB, and running everything from VB, rather than relying on macros.