0

how to get null field value from access in vb6

in my 2 record field the value is empty but i'm not able to get that empty field in vb6

...
....
set rs = new adodb.recordset
rs.open ("select * from table1 where id = '2'")
text1.text = rs!name

please help me out

2
Contributors
5
Replies
10
Views
4 Years
Discussion Span
Last Post by AndreRet
0

If I read this correctly, you have opened the recordset where the id = 2. According to you, the name field is empty??? thats why nothing shows in text1.text. What seems to be the problem then?

To check if it IS empty, you can do teh following...

If rs!name = vbnullstring Then
    msgbox "No Value Here..."
        Else
    text1.text = rs!name
End If
0

if i want to enter the text in the text1.text where the record field is null & save the it. what kind of code do i need to use there

please help me out

Edited by sachins1986

0

do the following...

...
....
set rs = new adodb.recordset
rs.open ("SELECT * FROM table1")

rs.AddNew
rs!name = text1.text
rs.update

If you want to save it to that specific record, do this...

...
    ....
    set rs = new adodb.recordset
    rs.open ("SELECT * FROM table1 WHERE id='2'")

    rs!name = text1.text
    rs.update
1

Is this code is correct to enter the empty record field

dim cn as new adodb.connection 
set cn = new adodb.connection
cn.execute "UPDATE Table1 SET T_city = '" & text1.text & "' where ID = '2'"
cn.close: set cn = nothing 
Votes + Comments
its a pleasure
1

Almost :)

dim cn as adodb.connection ''removed new... 
set cn = new adodb.connection
cn.execute "UPDATE Table1 SET T_city = '" & text1.text & "' where ID = '2'"
cn.close 

Should work just fine.

Votes + Comments
thanks
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.