Hi,
I apologise in advance for this, but I am trying to learn VBA - rather than cutting and pasting as I have done for so long.
I am trying to understand why i need to declare a reference to a form. For example I have some code which looks at information entered on a form, and runs two different append queries - to save entering some of the same parameters twice, then closes the form;
I have written this:
But my understanding is that I should do this:
Is there really a difference? And if so what and why? Any logical clear help gratefully received! Thanks.
I apologise in advance for this, but I am trying to learn VBA - rather than cutting and pasting as I have done for so long.
I am trying to understand why i need to declare a reference to a form. For example I have some code which looks at information entered on a form, and runs two different append queries - to save entering some of the same parameters twice, then closes the form;
I have written this:
Code:
DoCmd.OpenQuery "QryAppendNewSite", acViewNormal, acEdit
DoCmd.OpenQuery "QryAppendUpdateForm", acViewNormal, acEdit
DoCmd.Close acForm, "FrmCheck"
But my understanding is that I should do this:
Code:
Dim strCollect As String
Dim strFill As String
Dim strCheck As String
strCollect = "QryAppendNewSite"
strFill = "QryAppendUpdateForm"
strCheck = "FrmCheck"
DoCmd.OpenQuery strCollect, acViewNormal, acEdit
DoCmd.OpenQuery strFill, acViewNormal, acEdit
DoCmd.Close acForm, strCheck