I have been trying to write a procedure to update a form in a second database.
I have been able to reference the remote db OK and open the form in design mode but cannot work out how to then reference the form in CreateControl!
The relevant part of the code is
Sub NewBtn() Dim frm As Form Dim ctlBtn As Control Dim lngLine As Long Dim mdl As Module Dim strForm As String Dim AccessApp As New Access.Application Dim strDB As String strForm = "Form1" strDB = "C:DbFrontEndsdb1.mdb" AccessApp.OpenCurrentDatabase strDB AccessApp.DoCmd.OpenForm strForm, acDesign Set frm = AccessApp.Forms(strForm) Set mdl = frm.Module Set ctlBtn = CreateControl(frm.Name, acCommandButton, , "", "", 2500, 1000, 1000, 400) .....................
I was hoping that frm.Name would give me the reference to the remote form but generates the error