[RESOLVED] how to get ride of Null?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: [RESOLVED] how to get ride of Null?

  1. #1
    Join Date
    Sep 2010
    Posts
    38

    [RESOLVED] how to get ride of Null?

    Code:
    Private Sub cus()
    
    Dim cnview As New ADODB.connection
    Dim rsemployee As New ADODB.Recordset
    
    Call connection(cnview, App.Path & "\Commissions.mdb", "endromida")
    Call Recordset(rsemployee, cnview, "SELECT * FROM customer WHERE idcn ='" & txt1stID.Text & "'")
    
    If rsemployee.RecordCount = 0 Then
    MsgBox "The record you requested could not be found.", vbExclamation, "Medrar"
    Exit Sub
    End If
    
    
    With rsemployee
    txtFan.Text = .Fields!fname
    txtFisNa.Text = .Fields!fsna
    txtSecNa.Text = .Fields!sena
    txtLasNa.Text = .Fields!trna  --- Null Error
    txtFulNa.Text = .Fields!funame
    txtMob.Text = .Fields!mobie
    txtExpDate.Text = .Fields!exd
    End With
    
    Set cnview = Nothing
    Set rsemployee = Nothing
    End Sub
    Run time Error
    Null

    how to accept null values?

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,981

    Re: how to get ride of Null?

    Simple IF/Then statement around it, or an error trap that returns a default value.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,823

    Re: how to get ride of Null?

    I already told you two ways to solve your issue in the other thread,
    Why did you start a new thread on it?

    Simply append an empty string like I showed you in the other thread or use an if test to test for null

    Also when posting an error message it is best to post the actual error message so people can understand what you are talking about. In this case the error would be

    Invalid use of Null
    Always use [code][/code] tags when posting code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center