CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2001
    Posts
    29

    Invalid use of Null

    Hi,

    I want to populate a forms text boxes from an Access DB, if any of the fields are empty I get Invalid use of Null error, how can I get over this? what I have tried is:

    If Address.Fields("Suburb") = Null Then txtSurburb.Text = ""

    Any help appreciated.

    Regards,

    Alan.


  2. #2
    Join Date
    Mar 2001
    Location
    Australia
    Posts
    146

    Re: Invalid use of Null

    Try this:



    txtSuburb.text = Address.Fields("Suburb") & vbNullString





    That way you won't need the if statement.

    Hope this helps,

    Nathan Liebke


  3. #3
    Join Date
    Apr 2000
    Posts
    737

    Re: Invalid use of Null

    I think you can set that field to allow NULL value during you define the table provided it's not a key.

    cksiow
    http://vblib.virtualave.net - share our codes



  4. #4
    Join Date
    Jun 2000
    Posts
    104

    Re: Invalid use of Null

    there is a function to check if the field is null.
    try this:-
    if not isnull(fieldname) then
    code
    end if


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured