Problema con Trim
Publicado por Germany (53 intervenciones) el 03/04/2006 22:59:58
tengo el siguiente problema en la opcion de guardar datos
-----------------------------------------------------------------------------------------------------------------------------
Private Sub LaVolpeButton3_Click()
Dim dbs As Database, rst As Recordset
Set dbs = OpenDatabase(App.Path & "\alquiler_97.mdb")
If text1.Text <> " " Then
dbs.Execute " INSERT INTO alquiler " _
& "(expediente,locall,ano,nombre_pro,apellido_pro,telefono_pro,telefono2_pro,edificio,inquilino,alquiler,locall2,telefono_in,fecha,ano2,enero,febrero,mazo,abril,mayo,junio,julio,agosto,septiembre,octubre,noviembre,diciembre,observacion) VALUES " _
& "('" & text1 & "','" & text2 & "','" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Text6 & "','" & Text7 & "','" & Text8 & "','" & Text9 & "','" & Text10 & "','" & Text11 & "','" & Text12 & "','" & Text13 & "','" & Text14 & "','" & Text15 & "','" & Text16 & " ','" & Text17 & "','" & Text18 & "','" & Text19 & "','" & Text20 & "','" & Text21 & "','" & Text22 & "','" & Text23 & "','" & Text24 & "','" & Text25 & "','" & Text26 & "', '" & RichTextBox1 & "');"
Set rst = dbs.OpenRecordset("SELECT expediente, " _
& "locall," & "ano FROM alquiler " _
& "ORDER BY expediente & locall & ano ASC;")
rst.MoveLast
MsgBox "Datos Guardados", vbInformation + vbOKOnly, "Información"
Else
MsgBox "No hay Datos que Guardar,Ingrese Número de Expediente", vbCritical + vbOKOnly, "Información"
text1.SetFocus
End If
End Sub
---------------------------------------------------------------------------------------------------------------------
lo que quiero hacer es suprimir los espacios en blanco tanto a la derecha como a la izquierda de un texto para ello utilizo trim pero cuando coloco
Dim Trim As String
..........VALUES " _
& "('" & trim(text1) & "','...........);"
me sale error de compilacion se esperaba una matriz y se coloca en el primer trim, ayuda por favor se los agradesco mucho !!!!
Salu2
-----------------------------------------------------------------------------------------------------------------------------
Private Sub LaVolpeButton3_Click()
Dim dbs As Database, rst As Recordset
Set dbs = OpenDatabase(App.Path & "\alquiler_97.mdb")
If text1.Text <> " " Then
dbs.Execute " INSERT INTO alquiler " _
& "(expediente,locall,ano,nombre_pro,apellido_pro,telefono_pro,telefono2_pro,edificio,inquilino,alquiler,locall2,telefono_in,fecha,ano2,enero,febrero,mazo,abril,mayo,junio,julio,agosto,septiembre,octubre,noviembre,diciembre,observacion) VALUES " _
& "('" & text1 & "','" & text2 & "','" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Text6 & "','" & Text7 & "','" & Text8 & "','" & Text9 & "','" & Text10 & "','" & Text11 & "','" & Text12 & "','" & Text13 & "','" & Text14 & "','" & Text15 & "','" & Text16 & " ','" & Text17 & "','" & Text18 & "','" & Text19 & "','" & Text20 & "','" & Text21 & "','" & Text22 & "','" & Text23 & "','" & Text24 & "','" & Text25 & "','" & Text26 & "', '" & RichTextBox1 & "');"
Set rst = dbs.OpenRecordset("SELECT expediente, " _
& "locall," & "ano FROM alquiler " _
& "ORDER BY expediente & locall & ano ASC;")
rst.MoveLast
MsgBox "Datos Guardados", vbInformation + vbOKOnly, "Información"
Else
MsgBox "No hay Datos que Guardar,Ingrese Número de Expediente", vbCritical + vbOKOnly, "Información"
text1.SetFocus
End If
End Sub
---------------------------------------------------------------------------------------------------------------------
lo que quiero hacer es suprimir los espacios en blanco tanto a la derecha como a la izquierda de un texto para ello utilizo trim pero cuando coloco
Dim Trim As String
..........VALUES " _
& "('" & trim(text1) & "','...........);"
me sale error de compilacion se esperaba una matriz y se coloca en el primer trim, ayuda por favor se los agradesco mucho !!!!
Salu2
Valora esta pregunta


0