We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,716 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

how to get null field value from access in vb6

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
4 Hours
Discussion Span
5 Months Ago
Last Updated
7
Views
Question
Answered
sachins1986
Newbie Poster
5 posts since Nov 2012
Reputation Points: 12
Solved Threads: 1
Skill Endorsements: 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
AndreRet
Industrious Poster
4,706 posts since Jan 2008
Reputation Points: 391
Solved Threads: 481
Skill Endorsements: 20

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

sachins1986
Newbie Poster
5 posts since Nov 2012
Reputation Points: 12
Solved Threads: 1
Skill Endorsements: 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
AndreRet
Industrious Poster
4,706 posts since Jan 2008
Reputation Points: 391
Solved Threads: 481
Skill Endorsements: 20

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 
sachins1986
Newbie Poster
5 posts since Nov 2012
Reputation Points: 12
Solved Threads: 1
Skill Endorsements: 0
Question Answered as of 5 Months Ago by AndreRet

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.

AndreRet
Industrious Poster
4,706 posts since Jan 2008
Reputation Points: 391
Solved Threads: 481
Skill Endorsements: 20

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.1113 seconds using 2.69MB