Problem with checking data 
Author Message
 Problem with checking data

Hello all. Using VB3 standard and Access 1.1 datafiles. THe database
has a field that is defined as 'BYTE' and when that field is read and
compared with a number from a text box, a match is never found. Can
you imagine the frustration when you run the de{*filter*} and see that the
database contains a 3, the text box contains a 3 and the next If
statement fails an equality test?

How do I test this type of field?

TIA




Tue, 01 Feb 2000 03:00:00 GMT  
 Problem with checking data



Quote:
> Hello all. Using VB3 standard and Access 1.1 datafiles. THe database
> has a field that is defined as 'BYTE' and when that field is read and
> compared with a number from a text box, a match is never found. Can
> you imagine the frustration when you run the de{*filter*} and see that the
> database contains a 3, the text box contains a 3 and the next If
> statement fails an equality test?

> How do I test this type of field?

The problem, probably, is that the Byte field contains 3, whereas the text
box contains "3".  You should be using the Val() function on the contents
of your text box to convert it from a character to a number.

Bob Rossney



Tue, 01 Feb 2000 03:00:00 GMT  
 Problem with checking data



Quote:
> Hello all. Using VB3 standard and Access 1.1 datafiles. THe database
> has a field that is defined as 'BYTE' and when that field is read and
> compared with a number from a text box, a match is never found. Can
> you imagine the frustration when you run the de{*filter*} and see that the
> database contains a 3, the text box contains a 3 and the next If
> statement fails an equality test?

> How do I test this type of field?

> TIA



Ahh, but '3' and 3 are not the same thing...
the Byte contains a single ascii character with the value 3 (CTRL-C)
the textbox contains a single ascii character with the value 51 ('3')
You can't compare the ascii value with the ascii representation directly.
Use the ASC function to get the numeric value for the textbox character,
or assign the Byte value to a string or something along those lines.
--
Please reply through the newsgroup.  The reply e-mail
address is garbage to reduce the spam rate.


Tue, 01 Feb 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Periodical data check without using a timer control

2. Error Check to Test For Same Data Already in Table

3. check the data type

4. How make a field require data entry if any checkbox is checked

5. Checking data before submitting

6. checking input of data

7. Data type checking

8. Calculate data from the selected check boxes

9. VB.Net Client Checking for the existence of data on a SQL Server 2000

10. Data form with check boxes

11. Checking for data changes - reposted from mpdg

12. NEWBIE: Data checking

 

 
Powered by phpBB® Forum Software