Visual Basic - nayuda no consigo borrar registros

Life is soft - evento anual de software empresarial
 
Vista:

nayuda no consigo borrar registros

Publicado por lorenzo medinagarcia (9 intervenciones) el 04/09/2007 23:31:18
No consigo borrar registros de una base de datos, el codigo que utilizo es el siguiente, creo que el problema esta en la forma de capturar datos en los "Text", pero la verdad no encuentro el fallo, ayudenme por favor

el campo fechadelacita en la BD estan con fecha/hora.
lo datos se introducen en los text, y estos son los codigos

indiPrivate Sub Text5_KeyPress(KeyAscii As Integer)
Const Number$ = "0123456789." ' only allow these characters

If KeyAscii <> 8 Then
If InStr(Number$, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If

If Len(Text5) = 2 Or Len(Text5) = 5 Then
Text5 = Text5 & "/"
Text5.SelStart = Len(Text5)
End If
End Sub

Private Sub Text6_KeyPress(KeyAscii As Integer)
Const Number$ = "0123456789." ' only allow these characters

If KeyAscii <> 8 Then
If InStr(Number$, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If

If Len(Text6) = 2 Or Len(Text6) = 5 Then
Text6 = Text6 & "/"
Text6.SelStart = Len(Text6)
End If
End Sub

declarion de variable:
public dbtest as Dao.database

y cuando puo en el boto para borrar los registro el siguiente codigo:

Set dbTest = OpenDatabase("c:\manosbellas.mdb")
dbTest.Execute "Delete From citas Where diadelafecha Between #" & Text5 & "# And #" & Text6 & "#" , te ruego me digas si ves el error,

si alguien tiene algun ejemplo y me lo puede enviar se lo agradecera eternqmente. mi e-mail " [email protected]"
un saludo y perdonad lo torpe que soy pero no veo el error. gracias

Lorenzo Medna Garcia
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

RE:nayuda no consigo borrar registros

Publicado por P. J. (173 intervenciones) el 04/09/2007 23:44:04
Prueba:

"Delete From citas Where diadelafecha Between #" & FormatDateTime(Text5.text,vbShortDate ) & "# And #" & FormatDateTime(Text6.text,vbShortDate ) & "#"

O

"Delete From citas Where diadelafecha Between #" & Format(Text5.text,"dd/mm/yyyy" ) & "# And #" & Format(Text6.text,"dd/mm/yyyy") & "#"

Dependera muxo de como esten definidos los campos de fecha en tu BD
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar