CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2010

    [RESOLVED] how to get ride of Null?

    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

    how to accept null values?

  2. #2
    Join Date
    Jan 2006
    Fox Lake, IL

    Re: how to get ride of Null?

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

    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

    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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.