-
Before recording them I register I move like this the fields
rs.Fields ("te_nome ") = txtnome
rs.Fields ("te_endereco ") = txtender
rs.Fields ("te_bairro ") = txtbairro
rs.Fields ("te_cep ") = TDBMSKCEP
rs.Fields ("te_municipio ") = txtmunicipio
rs.Fields ("te_uf ") = DBCMBUF
rs.Fields ("te_telefone ") = tdbmskfone
rs.Fields ("do_sequencia ") = DBCombo1.Text
when I will record it gives the following message:
The field <name of the field> it cannot be a sequence of characters of length zero
I already tried to do the following:
rs.Fields ("te_bairro ") ="" & txtbairro
but doesn't it also work, as I should proceed?
------------------
The blessing of God enriches and it doesn't increase pains
-
Are you totally sure that the txtbairro variable is definitely not empty or zero-length? Have you used the debugging tools in VB and set up a watch on txtbairro, then stepped through the program, line by line?
-
Text fields have to be between ' or " (not sure which one it is for Access, SQL server uses '), and set the AllowZeroLength property to true if possible (allow Null values)
-
Excuse me , but txtnome, txtbairro are controls with data and some do not have data are null
How do I do to record these data?
------------------
The blessing of God enriches and it doesn't increase pains
-
I set up a function to handle nulls for databases:
Function nonulls(s As Variant) As String
'- string = NoNulls(string)
'Checks to see if the string passed is null, if so then return "" else return
'the passed string. A wrapper for access stuff.
If IsNull(s) Or Len(s) = 0 Then
nonulls = ""
Else
nonulls = s
End If
End Function
then I use it like this:
rs.Fields ("te_nome ") = nonulls(txtnome)
this will check if txtnome is empty(null), if it is, it will send back a blank string which the database can understand. Question though, do the fields that have empty text boxes have their AllowedZeroLength set to yes? That will stop it as well.
-
Do this. rs.Fields ("te_bairro") = txtbairro & " " (I've changed your "" to " "). When you read in the data use RTRIM to strip off the space at the end.
------------------
Marty
[This message has been edited by MartinLiss (edited 01-19-2000).]