Results 1 to 9 of 9

Thread: [VB6] Add forum doesn't work & Null issue

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2004
    Posts
    64

    [VB6] Add forum doesn't work & Null issue

    I finally got a few of the problems worked out in my program. I can now start it blank, and use clear commands and still search without error.

    However, I can't add new records to the database from an outside form for some reason. Also, I can't search for and or create any record entry in the database if the notes and other fields are left blank.

    Someone told me the later had something to do with Null.

    I attached the project archive to my post. Could someone perhaps take a look at it to try and figure out what's going wrong?

    Regards,
    ChaosBlizzard

  2. #2
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: [VB6] Add forum doesn't work & Null issue

    ChaosBlizzard,

    Can you re-attach as a .zip (WinZip) as it's common for most users.
    (or, posibly someone can attach a .zip version).




    Bruce.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2004
    Posts
    64

    Re: [VB6] Add forum doesn't work & Null issue

    Quote Originally Posted by Bruce Fox
    ChaosBlizzard,

    Can you re-attach as a .zip (WinZip) as it's common for most users.
    (or, posibly someone can attach a .zip version).




    Bruce.
    Okay, this one post has the file with the zip based compression.

  4. #4
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: [VB6] Add forum doesn't work & Null issue

    As a side issue, the following Function isn't structure correctly.
    (Note Functions return a value, Subs on the other hand do not).

    This:
    VB Code:
    1. Function Check_Null(in_text, out_Text)
    2. If IsNull(in_text) = True Then
    3. out_Text = " "
    4. Else
    5. out_Text = Trim(in_text)
    6. End If
    7. End Function

    Shhould be (something) like:
    VB Code:
    1. Private Function Check_Null(ByVal in_text As String) As String
    2.     If IsNull(in_text) = True Then
    3.         Check_Null = " "
    4.     Else
    5.         Check_Null = Trim(in_text)
    6.     End If
    7. End Function




    Bruce.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2004
    Posts
    64

    Re: [VB6] Add forum doesn't work & Null issue

    Quote Originally Posted by Bruce Fox
    As a side issue, the following Function isn't structure correctly.
    (Note Functions return a value, Subs on the other hand do not).

    This:
    VB Code:
    1. Function Check_Null(in_text, out_Text)
    2. If IsNull(in_text) = True Then
    3. out_Text = " "
    4. Else
    5. out_Text = Trim(in_text)
    6. End If
    7. End Function

    Shhould be (something) like:
    VB Code:
    1. Private Function Check_Null(ByVal in_text As String) As String
    2.     If IsNull(in_text) = True Then
    3.         Check_Null = " "
    4.     Else
    5.         Check_Null = Trim(in_text)
    6.     End If
    7. End Function




    Bruce.

    If I make changes like that I get an error that brings me to this line:
    OrigtxtAddress = (Check_Null(rs.Fields("MailingAddress"), out_Text))

    Wrong number of arguments or invalid property assignment.

  6. #6
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: [VB6] Add forum doesn't work & Null issue

    Possibly:
    VB Code:
    1. OrigtxtAddress = Check_Null(rs.Fields("MailingAddress"))

    The 'out_Text' is no longer required as the Function returns Check_Null!




    Bruce.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Nov 2004
    Posts
    64

    Re: [VB6] Add forum doesn't work & Null issue

    Quote Originally Posted by Bruce Fox
    Possibly:
    VB Code:
    1. OrigtxtAddress = Check_Null(rs.Fields("MailingAddress"))

    The 'out_Text' is no longer required as the Function returns Check_Null!




    Bruce.
    Thank you, I made the changes and corrected that line and another line that had the same problem as OrigtxtAddress.

    However, for some reason I still can't add a record and I can not search for a record without an error if "Notes" doesn't have valid data.
    Last edited by ChaosBlizzard; Mar 1st, 2005 at 10:50 AM.

  8. #8
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: [VB6] Add forum doesn't work & Null issue

    Just wrapping up that Function issue, I noticed that if 'in_text' is a Null, then you pass
    back a 'space' (" "); you may be better of with a zero length string "" (no space).

    EDIT: Having said that, is the purpose of the Function ONLY to ensure the readback data from the DB dosn't cause an error (as it may be a Null)?


    Bruce.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Nov 2004
    Posts
    64

    Re: [VB6] Add forum doesn't work & Null issue

    Quote Originally Posted by Bruce Fox
    Just wrapping up that Function issue, I noticed that if 'in_text' is a Null, then you pass
    back a 'space' (" "); you may be better of with a zero length string "" (no space).

    EDIT: Having said that, is the purpose of the Function ONLY to ensure the readback data from the DB dosn't cause an error (as it may be a Null)?


    Bruce.
    It's suppose to stop errors, but it doesn't work all that well. I have someone trying to help me with it. They put it there, and I have been tweaking the code.

    It will work, unless of course something is blank in the database.

    I still can't figure it out.

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