473,378 Members | 1,156 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

catch data type invalid error and convert it before system does

GOOOOD DAY. Geeks

This is my first post and I do not know whether my title makes sense to you.

Here is the problem..

I have a Access database. There is a table contains two fields called Latitude and Longitude which are stored as numerical coordinate, Number (Double, decimal).

Based on this table, i crated a form to fill in these two values.

I would like to create an error handling to give specific error message, or to convert these two coordinates to number if people input text format data in these field eg, (linear format 51° 28' 38" N to numerical 51.47222).

However, before the error event activated, I think the system captures this data invalid error, and gives the message "The Value you entered isn't valid for this field,,, for example, you may have entered........".

I have tried at least several hours to search and read through other people's post, but no luck at all.

Hope I explained my problem clearly to you and all your response or feedback is much appreciated!!!
Jul 22 '10 #1
8 2812
debasisdas
8,127 Expert 4TB
you need to check the validity of data at front end before passing the same to database for processing.
Jul 23 '10 #2
NeoPa
32,556 Expert Mod 16PB
Are you doing this in VB or in Access? If the latter then this is posted in the wrong forum.

Anyway, I think you're going about this the wrong way. It seems you have a control defined as accepting numeric data only, and you want to capture the error when (valid) non-numeric data is entered. What you need to do surely is to change the control so that it doesn't expect only numeric data.
Jul 24 '10 #3
I am doing this in Access. Unfortuanately the post i put up on Access forum got deleted, because i accidently post it up here first.

Anyway. Thank you people, i think i understand the situation now which I should not bound the object for numberic data only from the "table" level.

Have a great coming week!
Jul 25 '10 #4
NeoPa
32,556 Expert Mod 16PB
jwan142: I am doing this in Access. Unfortuanately the post i put up on Access forum got deleted, because i accidently post it up here first.
No. It got deleted because you posted the same question twice. You should have posted a link from one forum to the question already posted in the other. Alternatively, as in this case, you could have requested it be moved as this has nothing to do with the VB language. I'll move this across for you now.
jwan142: i think i understand the situation now which I should not bound the object for numberic data only from the "table" level.
If you do understand then that's a strange response. It's about throwing away restrictions on the data being numeric - not about whether or not the control is bound.
Jul 25 '10 #5
What am I probably going to do is to change the attribute type in the original from number (long) to text. Then set up some conditions/catches in the "beforeupdate" event.

Please correct me if i am on a totally wrong direction.
Jul 25 '10 #6
@jwan142
That sounds about right. You can have the textbox as unbound, so it will accept any data type. I would use the after update event to go back and check the value, if the value is in lat/longitude format, leave it, if it is in degrees, make a conversion function to convert it to lat/long format, and if it's not in degrees or lat/long format, msgbox the error then return focus to that field.

You would also probably want to add the same sort of check for when you click on the button or whatever triggers your form to save the data whether it's a save btn or next record btn, etc, have it recheck the value of that box one last time before saving the value of the textbox into the associated table.
Jul 26 '10 #7
NeoPa
32,556 Expert Mod 16PB
That's a good idea Wacko.

I would consider changing the type of the underlying field to Text though. This way one needn't complicate matters with unbound controls (which would properly create a need to manage a related but hidden bound control anyway), and can apply the updates you suggest within a single bound control.

Welcome to Bytes!
Jul 26 '10 #8
NeoPa
32,556 Expert Mod 16PB
jwan142: What am I probably going to do is to change the attribute type in the original from number (long) to text. Then set up some conditions/catches in the "beforeupdate" event.

Please correct me if i am on a totally wrong direction.
That seems very sensible. WackoZacho has posted some good ideas about how to handle the BeforeUpdate part of it. That should be all you need, but if further assistance is required post back :)
Jul 26 '10 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Laurel | last post by:
this is driving me crazy. i need to use a form control as a criteria in a select query, and the control's value is set depending upon what a user selects in an option group on the form. the query...
2
by: Chicken Kebab Abdullah | last post by:
Does anyone know why I get the error 3464 Data type mismatch from the following code. I have a form with a combo(to choose a consumable) and 2 list boxes on it. list on left is all printers...
3
by: Martin Lacoste | last post by:
Is there some issue with using too many left/right/mid/len functions in queries? Depending on the usage, they work fine, but... then there's here: SELECT Master_CAO.Incipit,...
0
by: news.paradise.net.nz | last post by:
I have been developing access databases for over 5 years. I have a large database and I have struck this problem with it before but can find nothing in help or online. Access 2000 I have a query...
3
by: martlaco1 | last post by:
Trying to fix a query that (I thought) had worked once upon a time, and I keep getting a Data Type Mismatch error whenever I enter any criteria for an expression using a Mid function. Without the...
5
by: David | last post by:
Hi, Getting the following error:- Microsoft JET Database Engine error '80040e07' Data type mismatch in criteria expression. The code is as follows, and the last line is the one that...
1
by: lalbee | last post by:
I am trying to use the Dcount function but receive a data type mismatch error, can someone help me determine the cause? Count: DCount("","qry-final everhome results"," <'0' ") Thanks!
2
by: preeti13 | last post by:
i am tring to retrive the value form the data base but getting erorr i tried so many way but i didn't get the value i got the erorr like this: Implicit conversion from data type datetime to int is...
1
by: fd1 | last post by:
Hi All, I'm getting Data Type Mismatch error when I run the following query: SELECT tbl1.Definition, tbl2.Group FROM tbl1, tbl2 WHERE ((Mid$(!,6)=Mid$(!,9))); Both "Definition" and...
4
by: shalskedar | last post by:
I want to transfer the excel data to th Db ..thru the VBA code. In the DB there is a table called outer2 containing 1 of the columns as "Upvc" whose format is set to Long integer. When i try to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.