Ayuda con el metodo execute
Tengo un pequeño problema en mi base de datos estoy usando Visual Basic 6.0 conexion ADO a Access 2000 tengo mis declaraciones bien mi cadena de conexion bien que sucede tengo el siguiente codigo:
If Verificar_Datos Then
sSQL = "INSERT INTO miembros "
sSQL = sSQL & "(mnombres, mapellidos, mdirecc1, mdirecc2, "
sSQL = sSQL & "mfnacim, mlugarnac, mnaciona, mcelular, mcedula, mestcivil, "
sSQL = sSQL & "mbeeper, memail, mtelefon, mprofesion, msexo, mtiposangre, "
sSQL = sSQL & "mcontacto, mtelefonocontacto, mrazon, mestado, mfechaconversion, "
sSQL = sSQL & "mfechabautismo, miglesiabautismo, mministerio, mministro, "
sSQL = sSQL & "mmiembroadherente, mcargo, mobservaciones) "
sSQL = sSQL & "VALUES ('" & Trim(txtNombre.Text) & "', '" & Trim(txtApellidos.Text) & "', '"
sSQL = sSQL & Trim(txtDireccion1.Text) & "', '" & Trim(txtDireccion2.Text) & "', '"
sSQL = sSQL & mskFechaNacimiento.Text & "', '" & Trim(txtLugarNacimiento.Text) & "', '"
sSQL = sSQL & Trim(txtNacionalidad.Text) & "', '" & mskCelular.Text & "', '"
sSQL = sSQL & mskCedula.Text & "', " & Buscar_ID_EstadoCivil(cboEstadoCivil.Text) & ", '"
sSQL = sSQL & mskBeeper.Text & "', '" & Trim(txtEmail.Text) & "', '"
sSQL = sSQL & mskTelefonoCasa.Text & "', '" & Trim(txtProfesion.Text) & "', "
sSQL = sSQL & IIf(optSexo(0).Value = True, 0, 1) & ", "
sSQL = sSQL & Buscar_ID_TipoSangre(cboTipoSangre.Text) & ", '"
sSQL = sSQL & Trim(txtContacto.Text) & "', '" & mskTelefonoContacto.Text & "', "
sSQL = sSQL & Razon & ", " & Estado & ", '" & mskFechaConversion.Text & "', '"
sSQL = sSQL & mskFechaBautismo.Text & "', '" & Trim(txtIglesiaBautismo.Text) & "', '"
sSQL = sSQL & Trim(txtMinisterio.Text) & "', '" & Trim(txtMinistro.Text) & "', "
sSQL = sSQL & IIf(chkMiembroAdherente.Value = False, 0, 1) & ", '" & Trim(txtCargo.Text) & "', '"
sSQL = sSQL & Trim(txtObservaciones.Text) & "')"
dbIglesia.Execute sSQL, , adCmdText
MsgBox "Miembro registrado correctamente...", vbInformation, App.ProductName
Call Limpiar_Campos(frmMiembros)
lblCodigo.Caption = Aumentar_Registro("miembros", "mcodigo")
tabPrincipal.Tab = 0
End If
en mi boton para guardar registros cuando ejecuto me da un error que dice:
run-time error '-2147217913 (80040e07)':
data type mismatch in criteria expression
Nesecito ayuda para solucionar este problema que me tiene ya listo......
If Verificar_Datos Then
sSQL = "INSERT INTO miembros "
sSQL = sSQL & "(mnombres, mapellidos, mdirecc1, mdirecc2, "
sSQL = sSQL & "mfnacim, mlugarnac, mnaciona, mcelular, mcedula, mestcivil, "
sSQL = sSQL & "mbeeper, memail, mtelefon, mprofesion, msexo, mtiposangre, "
sSQL = sSQL & "mcontacto, mtelefonocontacto, mrazon, mestado, mfechaconversion, "
sSQL = sSQL & "mfechabautismo, miglesiabautismo, mministerio, mministro, "
sSQL = sSQL & "mmiembroadherente, mcargo, mobservaciones) "
sSQL = sSQL & "VALUES ('" & Trim(txtNombre.Text) & "', '" & Trim(txtApellidos.Text) & "', '"
sSQL = sSQL & Trim(txtDireccion1.Text) & "', '" & Trim(txtDireccion2.Text) & "', '"
sSQL = sSQL & mskFechaNacimiento.Text & "', '" & Trim(txtLugarNacimiento.Text) & "', '"
sSQL = sSQL & Trim(txtNacionalidad.Text) & "', '" & mskCelular.Text & "', '"
sSQL = sSQL & mskCedula.Text & "', " & Buscar_ID_EstadoCivil(cboEstadoCivil.Text) & ", '"
sSQL = sSQL & mskBeeper.Text & "', '" & Trim(txtEmail.Text) & "', '"
sSQL = sSQL & mskTelefonoCasa.Text & "', '" & Trim(txtProfesion.Text) & "', "
sSQL = sSQL & IIf(optSexo(0).Value = True, 0, 1) & ", "
sSQL = sSQL & Buscar_ID_TipoSangre(cboTipoSangre.Text) & ", '"
sSQL = sSQL & Trim(txtContacto.Text) & "', '" & mskTelefonoContacto.Text & "', "
sSQL = sSQL & Razon & ", " & Estado & ", '" & mskFechaConversion.Text & "', '"
sSQL = sSQL & mskFechaBautismo.Text & "', '" & Trim(txtIglesiaBautismo.Text) & "', '"
sSQL = sSQL & Trim(txtMinisterio.Text) & "', '" & Trim(txtMinistro.Text) & "', "
sSQL = sSQL & IIf(chkMiembroAdherente.Value = False, 0, 1) & ", '" & Trim(txtCargo.Text) & "', '"
sSQL = sSQL & Trim(txtObservaciones.Text) & "')"
dbIglesia.Execute sSQL, , adCmdText
MsgBox "Miembro registrado correctamente...", vbInformation, App.ProductName
Call Limpiar_Campos(frmMiembros)
lblCodigo.Caption = Aumentar_Registro("miembros", "mcodigo")
tabPrincipal.Tab = 0
End If
en mi boton para guardar registros cuando ejecuto me da un error que dice:
run-time error '-2147217913 (80040e07)':
data type mismatch in criteria expression
Nesecito ayuda para solucionar este problema que me tiene ya listo......
hola jreyes
para comenzar veo que cuando haces esto:
sSQL = sSQL & Trim(txtDireccion1.Text) & "'
esta mal, ya que debe ser asi:
sSQL = sSQL & " ' " & Trim(txtDireccion1.Text) & " ' ,"
pongo espacio para que puedas distinguir
y eso es para todo los que siguen.
espero te sirva de algo mi comentario
para comenzar veo que cuando haces esto:
sSQL = sSQL & Trim(txtDireccion1.Text) & "'
esta mal, ya que debe ser asi:
sSQL = sSQL & " ' " & Trim(txtDireccion1.Text) & " ' ,"
pongo espacio para que puedas distinguir
y eso es para todo los que siguen.
espero te sirva de algo mi comentario