|
-
Jan 18th, 2000, 06:54 PM
#1
Thread Starter
Lively Member
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
-
Jan 18th, 2000, 07:01 PM
#2
Frenzied Member
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?
-
Jan 18th, 2000, 07:02 PM
#3
Hyperactive Member
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)
-
Jan 18th, 2000, 08:17 PM
#4
Thread Starter
Lively Member
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
-
Jan 19th, 2000, 01:07 AM
#5
Hyperactive Member
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.
-
Jan 19th, 2000, 12:46 PM
#6
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).]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|