
Error de sintaxis Base de datos, Visual "Cliente", Acces "Base de datos"
Publicado por Harrison (3 intervenciones) el 29/11/2021 20:30:58
Buenos dias, cree una base detos basandome en un video de youtube, a la cual le realice varias modificaciones una de ellas es insertar VBA.Time a la vez de un VBA.Date, poseo un error de sintaxis, ya que no encuento la manera de unir la linea de codigo "', C.FECHA = #" & Format(Fecha, "mm/dd/yyyy") & "# WHERE (C.Id = " & id & "); con la linea de codigo "', C.HORA = #" & Format(Hora, "hh:mm:ss" "# WHERE (C.Id = " & id & ");"
Estaria demasiado agradecido si alguien me pudiera ayudar, el error unicamente lo presento en el boton de editar, en el boton de eliminar o crear no presento ningun tipo de error.
___________________________________________________________________________________________
Este es el Id que tengo creado para la union de la Matriz de acces. el cual no me ha presentado errores.
Dim señal As Boolean
Dim id As Long
Dim DocumentoAux As String
__________________________________________________________________________________________
Private Sub cmdEditar_Click()
If Not señal Then
MsgBox " Para editar Busque un Documento. "
Else
With Visitantes
If .txtNombre.Text = "" Then
MsgBox "Ingese un nombre"
.txtNombre.SetFocus
Exit Sub
End If
If .lstTipoDocumento.ListIndex = -1 Then
MsgBox "Ingese un Tipo de Documento"
.lstTipoDocumento.SetFocus
Exit Sub
End If
If .txtNumDoc.Text = "" Then
MsgBox "Ingese un Numero de documento"
.txtNumDoc.SetFocus
Exit Sub
End If
If .txtTelef.Text = "" Then
MsgBox "Ingese un Numero de Telefono"
.txtTelef.SetFocus
Exit Sub
End If
If .txtCelu.Text = "" Then
MsgBox "Ingese un Numero de celular"
.txtCelu.SetFocus
Exit Sub
End If
If .lstTipodepersona.ListIndex = -1 Then
MsgBox "Ingese un Tipo de Documento"
.lstTipodepersona.SetFocus
Exit Sub
End If
If .txtEmpresa.Text = "" Then
MsgBox "Ingese nombre de Empresa"
.txtEmpresa.SetFocus
Exit Sub
End If
If .txtcorreo.Text = "" Then
MsgBox "Ingese una direccion de Correo"
.txtcorreo.SetFocus
Exit Sub
End If
If .lstVisita.ListIndex = -1 Then
MsgBox "Ingese una razon de visita"
.lstVisita.SetFocus
Exit Sub
End If
End With
Dim NumerodeDocumento As String
Dim NombreCompleto As String
Dim TipodeDocumento As String
Dim Telefono As String
Dim Celular As String
Dim Tipodepersona As String
Dim Empresa As String
Dim CorreoElectronico As String
Dim Razondevisita As String
Dim Fecha As Date
Dim Hora As Date
With Visitantes
NumerodeDocumento = .txtNumDoc
NombreCompleto = .txtNombre
TipodeDocumento = .lstTipoDocumento
Telefono = .txtTelef
Celular = .txtCelu
Tipodepersona = .lstTipodepersona
Empresa = .txtEmpresa
CorreoElectronico = .txtcorreo
Razondevisita = .lstVisita
End With
Fecha = VBA.Date
Hora = VBA.Time
Dim sqlEditar As String
sqlEditar = "UPDATE VISITANTES AS C SET C.NUMERODEDOCUMENTO = '" & NumerodeDocumento & _
"', C.NOMBRECOMPLETO = '" & NombreCompleto & "', C.TIPODEDOCUMENTO = '" & TipodeDocumento & _
"', C.TELEFONO = '" & Telefono & "', C.CELULAR = '" & Celular & "', C.TIPODEPERSONA = '" & Tipodepersona & _
"', C.EMPRESA = '" & Empresa & "', C.CORREOELECTRONICO = '" & CorreoElectronico & "', C.RAZONDEVISITA = '" & Razondevisita & _
"', C.FECHA = #" & Format(Fecha, "mm/dd/yyyy") & "# WHERE (C.Id = " & id & "); & _
"', C.HORA = #" & Format(Hora, "hh:mm:ss" "# WHERE (C.Id = " & id & ");"
Estaria demasiado agradecido si alguien me pudiera ayudar, el error unicamente lo presento en el boton de editar, en el boton de eliminar o crear no presento ningun tipo de error.
___________________________________________________________________________________________
Este es el Id que tengo creado para la union de la Matriz de acces. el cual no me ha presentado errores.
Dim señal As Boolean
Dim id As Long
Dim DocumentoAux As String
__________________________________________________________________________________________
Private Sub cmdEditar_Click()
If Not señal Then
MsgBox " Para editar Busque un Documento. "
Else
With Visitantes
If .txtNombre.Text = "" Then
MsgBox "Ingese un nombre"
.txtNombre.SetFocus
Exit Sub
End If
If .lstTipoDocumento.ListIndex = -1 Then
MsgBox "Ingese un Tipo de Documento"
.lstTipoDocumento.SetFocus
Exit Sub
End If
If .txtNumDoc.Text = "" Then
MsgBox "Ingese un Numero de documento"
.txtNumDoc.SetFocus
Exit Sub
End If
If .txtTelef.Text = "" Then
MsgBox "Ingese un Numero de Telefono"
.txtTelef.SetFocus
Exit Sub
End If
If .txtCelu.Text = "" Then
MsgBox "Ingese un Numero de celular"
.txtCelu.SetFocus
Exit Sub
End If
If .lstTipodepersona.ListIndex = -1 Then
MsgBox "Ingese un Tipo de Documento"
.lstTipodepersona.SetFocus
Exit Sub
End If
If .txtEmpresa.Text = "" Then
MsgBox "Ingese nombre de Empresa"
.txtEmpresa.SetFocus
Exit Sub
End If
If .txtcorreo.Text = "" Then
MsgBox "Ingese una direccion de Correo"
.txtcorreo.SetFocus
Exit Sub
End If
If .lstVisita.ListIndex = -1 Then
MsgBox "Ingese una razon de visita"
.lstVisita.SetFocus
Exit Sub
End If
End With
Dim NumerodeDocumento As String
Dim NombreCompleto As String
Dim TipodeDocumento As String
Dim Telefono As String
Dim Celular As String
Dim Tipodepersona As String
Dim Empresa As String
Dim CorreoElectronico As String
Dim Razondevisita As String
Dim Fecha As Date
Dim Hora As Date
With Visitantes
NumerodeDocumento = .txtNumDoc
NombreCompleto = .txtNombre
TipodeDocumento = .lstTipoDocumento
Telefono = .txtTelef
Celular = .txtCelu
Tipodepersona = .lstTipodepersona
Empresa = .txtEmpresa
CorreoElectronico = .txtcorreo
Razondevisita = .lstVisita
End With
Fecha = VBA.Date
Hora = VBA.Time
Dim sqlEditar As String
sqlEditar = "UPDATE VISITANTES AS C SET C.NUMERODEDOCUMENTO = '" & NumerodeDocumento & _
"', C.NOMBRECOMPLETO = '" & NombreCompleto & "', C.TIPODEDOCUMENTO = '" & TipodeDocumento & _
"', C.TELEFONO = '" & Telefono & "', C.CELULAR = '" & Celular & "', C.TIPODEPERSONA = '" & Tipodepersona & _
"', C.EMPRESA = '" & Empresa & "', C.CORREOELECTRONICO = '" & CorreoElectronico & "', C.RAZONDEVISITA = '" & Razondevisita & _
"', C.FECHA = #" & Format(Fecha, "mm/dd/yyyy") & "# WHERE (C.Id = " & id & "); & _
"', C.HORA = #" & Format(Hora, "hh:mm:ss" "# WHERE (C.Id = " & id & ");"
- Visitantes.rar(3,7 KB)
Valora esta pregunta


0