I have a form that uses the command AddContactfromOutlook. I used the standard example given by Microsoft and it works flawlessly in the form. When I use the form as a subform this command button breaks. Any ideas?
I have a form that uses the command AddContactfromOutlook. I used the standard example given by Microsoft and it works flawlessly in the form. When I use the form as a subform this command button breaks. Any ideas?
Maybe if you post the code you used, we could start to understand where the problem is.
This is the standard code from Microsoft. I did not write it. Basically there is a command button tied to an embedded Macro on my form.
When I create a new form and add the subform control to it and move my form to it. The command button no longer functions. Works fine in the form but when the form is used as a subform it breaks.
Here is the micrsoft code:
'------------------------------------------------------------
' cmdAddFromOutlook_Click
'
'------------------------------------------------------------
Private Sub cmdAddFromOutlook_Click()
On Error GoTo cmdAddFromOutlook_Click_Err
On Error Resume Next
DoCmd.RunCommand acCmdAddFromOutlook
cmdAddFromOutlook_Click_Exit:
Exit Sub
cmdAddFromOutlook_Click_Err:
MsgBox Error$
Resume cmdAddFromOutlook_Click_Exit
End Sub
I am not a big fan of embedded Macros so I do not have much experience with them. If you have a form with a Command Button and you embed a macro to the Command Button, you will need to keep that form as is. In other words, copying the Command Button to other form objects will not create the desired results.
I suggest creating the form and subform first. You can edit the form Object within the subform container while in design view of the Main Form. Select the subform control/container and then select the form object itself by clicking the object inside the container. Now you can add a new Command Button and embed a macro.