dimanche 1 mars 2015

Error call sub VBA access addesign

First, I apologize for my english. Its not my first language.


Second, I am trying call to sub (ConfiguracionFormulario) from Form_load using like parameter input ME or Forms![REGIMEN], the name of form is REGIMEN.


I tried use "Forms![REGIMEN]" with docmd and the code run fine, but if I use variables like "Forms![FormInput.Name]" then it dont run.


I though use string parameter on ConfiguracioFormulario instead of form, and too Form_REGIMEN.


I'm sure that I have any problem of conceptually, but I'm noob on vba.



Private Sub Form_Load()
ConfiguracionFormulario Me
End Sub

Private Sub ConfiguracionFormulario(ByRef FormInput As Form)

Dim strFormInput As String

strFormInput = FormInput.Name

If FormInput.AutoCenter = False Then
'Cerramos el formulario en vista normal, y lo abrimos en modo diseño
DoCmd.Close acForm, strFormInput, acSaveYes
DoCmd.OpenForm strFormInput, acDesign, , , , acHidden

'Ajustamos las propiedades que solo pueden ser ajustadas en modo diseño
FormatInput.AutoCenter = True

'Cerramos el formulario en vista diseño, y lo abrimos en modo normal. Guardo configuración para no entrar en bucle
DoCmd.Close acForm, strFormInput, acSaveYes
DoCmd.OpenForm strFormInput, acNormal

End If
End sub


Someone could say why this launch error message? Thanks in advance.


Aucun commentaire:

Enregistrer un commentaire