1.11M Members

how to get null field value from access in vb6

 
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

 
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

 
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 
Question Answered as of 1 Year Ago by AndreRet
 
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.

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: