|
-
Feb 28th, 2005, 07:42 PM
#1
Thread Starter
Lively Member
[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
-
Feb 28th, 2005, 08:57 PM
#2
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.
-
Feb 28th, 2005, 09:06 PM
#3
Thread Starter
Lively Member
Re: [VB6] Add forum doesn't work & Null issue
 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.
-
Feb 28th, 2005, 09:16 PM
#4
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:
Function Check_Null(in_text, out_Text)
If IsNull(in_text) = True Then
out_Text = " "
Else
out_Text = Trim(in_text)
End If
End Function
Shhould be (something) like:
VB Code:
Private Function Check_Null(ByVal in_text As String) As String
If IsNull(in_text) = True Then
Check_Null = " "
Else
Check_Null = Trim(in_text)
End If
End Function
Bruce.
-
Feb 28th, 2005, 09:53 PM
#5
Thread Starter
Lively Member
Re: [VB6] Add forum doesn't work & Null issue
 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:
Function Check_Null(in_text, out_Text)
If IsNull(in_text) = True Then
out_Text = " "
Else
out_Text = Trim(in_text)
End If
End Function
Shhould be (something) like:
VB Code:
Private Function Check_Null(ByVal in_text As String) As String
If IsNull(in_text) = True Then
Check_Null = " "
Else
Check_Null = Trim(in_text)
End If
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.
-
Mar 1st, 2005, 06:36 AM
#6
Re: [VB6] Add forum doesn't work & Null issue
Possibly:
VB Code:
OrigtxtAddress = Check_Null(rs.Fields("MailingAddress"))
The 'out_Text' is no longer required as the Function returns Check_Null!
Bruce.
-
Mar 1st, 2005, 10:42 AM
#7
Thread Starter
Lively Member
Re: [VB6] Add forum doesn't work & Null issue
 Originally Posted by Bruce Fox
Possibly:
VB Code:
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.
-
Mar 1st, 2005, 03:08 PM
#8
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.
-
Mar 1st, 2005, 03:26 PM
#9
Thread Starter
Lively Member
Re: [VB6] Add forum doesn't work & Null issue
 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|