Base de datos mediante formulario

hola señores expertos soy un primerizo en vba y la vdd deseo hacer una base de datos mediante un formulario al ejecutarlo me sale el siguiente error Private Sub UserForm_Initialize() y no se ejecuta lo volví a hacer y el caso es que me sale siempre el mismo error podrían ayudarme por favor 

este es mi proyecto

Private Sub CommandButton1_Click()
Dim emptyRow As Long

'Make Sheet1 Active
Sheets(1).Activate

'Determine EmptyRow
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1

'Transfer information
Cells(emptyRow, 1).Value = NombreTextBox.Value
Cells(emptyRow, 2).Value = NssTextBox.Value
Cells(emptyRow, 3).Value = CalleTextBox.Value
Cells(emptyRow, 4).Value = ColoniTextBox.Value
Cells(emptyRow, 5).Value = CiudadTextBox.Value
Cells(emptyRow, 6).Value = EntidadTextBox.Value
Cells(emptyRow, 7).Value = CpTextBox.Value
Cells(emptyRow, 8).Value = EdadTextBox.Value
Cells(emptyRow, 9).Value = CurpTextBox.Value
Cells(emptyRow, 10).Value = RfcTextBox.Value
Cells(emptyRow, 11).Value = DomlabTextBox.Value
Cells(emptyRow, 12).Value = ContratoTextBox.Value
Cells(emptyRow, 13).Value = TipoTextBox.Value
Cells(emptyRow, 14).Value = FechaTextBox.Value
Cells(emptyRow, 15).Value = PeriodoTextBox.Value
Cells(emptyRow, 16).Value = PuestoTextBox.Value
Cells(emptyRow, 17).Value = SdTextBox.Value
Cells(emptyRow, 18).Value = FormaTextBox.Value
Cells(emptyRow, 19).Value = CuentaTextBox.Value

End Sub

Private Sub CommandButton2_Click()

Call UserForm_Initialize

End Sub


Private Sub UserForm_Click()

End Sub

Private Sub UserForm_Initialize()       <--------------- aqui me da el error

'Empty NombreTextBox
NombreTextBox.Value = ""
'Empty NssTextBox
NssTextBox.Value = ""
'Empty CalleTextBox
CalleTextBox.Value = ""
'Empty ColoniaTextBox
ColoniaTextBox.Value = ""
'Empty ciudadTextBox
CiudadTextBox.Value = ""
'Empty EntidadTextBox
EntidadTextBox.Value = ""
'Empty CpTextBox
CpTextBox.Value = ""
'Empty EdadTextBox
EdadTextBox.Value = ""
'Empty CurpTextBox
CurpTextBox.Value = ""
'Empty RfcTextBox
RfcTextBox.Value = ""
'Empty DomLabTextBox
DomlabTextBox.Value = ""
'Empty ContratoTextBox
ContratoTextBox.Value = ""
'Empty TipocontratoTextBox
TipocontratpTextBox.Value = ""
'Empty FechacontratoTextBox
FechacontratoTextBox.Value = ""
'Empty PeriodocontratoTextBox
periodocontratoTextBox.Value = ""
'Empty PuestoTextBox
PuestoTextBox.Value = ""
'Empty SdnominaTextBox
SdnominaTextBox.Value = ""
'Empty FormapagoTextBox
FormapagoTextBox.Value = ""
'Empty cuentaTextBox
CuentaTextBox.Value = ""

End Sub

la vdd espero me puedan ayudar ya que me ayudaria mucho esto con esta base 

muchas gracias saludos 

1 Respuesta

Respuesta
1

Prueba a cambiar esto:

Private Sub CommandButton2_Click()

Call UserForm_Initialize

End Sub

por esto otro:

Private Sub CommandButton2_Click()

UserForm.Show

End Sub

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas