# Thread: turning simbols to meaningful data.

1. Registered User
Join Date
Feb 2009
Posts
19

## Unanswered: turning simbols to meaningful data.

Halo there, need some pro to help me to work this puzzle that buzzing on my head.

If i have a set of data :

791011-12-5739 (actual data input : 791011125739)
or
610130-12-5664 (actual data input : 610130125664)

---------------------------
So, how can i make this data : 791011 ----> 11/10/1979
610130-----> 30/01/1961

5739 -----> Male (referring to last digit '1,3,5,7,9')
5664 -----> Female (referring to last digit '0, 2, 4,6,8)

--------with automation filling data.
Target 1.

Input data : 791011125739

---auto generate
Date of birth : 11/10/1979
Gender/ Sex : Male

Target 2

Input data : 610130125664

---auto generate
Date of birth : 30/01/1961
Gender / Sex : Female

....Pro, help me with this auto generate puzzle. TQ

2. Registered User
Join Date
Jun 2007
Location
Maitland NSW,Australia
Posts
401
Example 791011125739
Use the MID function to format 791011 into a date.

Then use the RIGHT function to determine the last digit. Use the CASE statement to determine the GENDER/SEX based on the value from the RIGHT function.

Is your example a numeric value or text? How would the year 2003 be displayed 031011125739 or 31011125739? Also, at what point in your data does the year change from 1900 to 2000 format?

3. Registered User
Join Date
Feb 2009
Posts
19

## Re

setting data ---> numeric.
i assume that if i input 001107 ----> output : 07/11/2000
(This b'cos i am handling patient database in a realtime (present))

could u plz teach me VBA so i can get the result?? Specific...

TQ. Pro

4. Registered User
Join Date
Feb 2009
Posts
19

## re

Correction ----> Setting data input : text

5. Registered User
Join Date
Jun 2007
Location
Maitland NSW,Australia
Posts
401
Ok, so the data is a text file. Now the first two digits represent the year if the digits are before 10 then one the user can assume that the year range is 1910 to 1999. Before 10 then the date range is 2000 to 2009. How would you code a person who is 100 years and older i.e. born before 1910?

Using your example actual data input : 791011125739 is this entered on a form and where do you want the Date of Birth and Gender/Sex displayed or stored?

6. Registered User
Join Date
Feb 2009
Posts
19

## re

Assume that i've a set set of table.

The contains:
1. Id_Patient ( example : 791011125479) (input)
2. DOB (date of birth : 11/10/1979 <--- generate from vba code)
3. Gender ( 'male' <----generate from vba code)

-----data input should be done on form (user interface)
-----data stored on table.

Chart Flow:

Input data (Id_Patient)-----auto generate---------->DOB & Gender
Last edited by nabalu; 04-07-09 at 00:04.

7. Registered User
Join Date
Feb 2009
Posts
19

## re

The aged who =/> 100 years, is entered by difference way. Using another method,; but for now, pro, can we focus on this??? TQ

8. Registered User
Join Date
Jun 2007
Location
Maitland NSW,Australia
Posts
401
Here is a sample database

Enter the patient ID on the form, then the DOB and Gender will be generated after the Patient ID is entered.

This assumes that the coding for the date of birth is correct e.g. 791231 and not 791232 etc.

9. Registered User
Join Date
Feb 2009
Posts
19
TQ Pro,.. it was great that u've done it. Great to know u.

Thx to u.
Last edited by nabalu; 04-07-09 at 00:53.

10. Registered User
Join Date
Feb 2009
Posts
19

## handling error

assume, i entered a wrong input (791032),.. error handler do this.
---> 1. error msg appear && database not update.
---> 2. error msg appear 'asking for the right data?'

Q. How to accomplish this?
Last edited by nabalu; 04-07-09 at 02:56.

11. Registered User
Join Date
Jun 2007
Location
Maitland NSW,Australia
Posts
401
It is possible to validate the date part of the input. But first I would change the form layout and use an unbound form as you can have better control over the input etc.

12. Registered User
Join Date
Feb 2009
Posts
19

## re

Pro, sorry for asking ur help too much, but, i am lack of knowledge with vba; but i understand what it does. i love vb, cos' i've done great things with ms access. All hard coded on my current project taken from various site, but, still, i can't write the code my self.

13. Registered User
Join Date
Jun 2007
Location
Maitland NSW,Australia
Posts
401
You can not ask too many questions, this is the way that you learn.

Do you still want validation for your data input as per your previous post? If so I will post an updated version over the next few days, when time permits.

14. Registered User
Join Date
Feb 2009
Posts
19
TQ. Yes, pro, i would like to.

15. Registered User
Join Date
Feb 2009
Posts
19

## little more vba code help.

Halo pro.
This is an add on with the current ID_Patient code.

Let me begin with :

Patient ID = 891009125859

'I would like to extract only the last 4 digit = 5859
'then reformat it (txtReformat_1) to be = 9585
With this data, 5859 ; i need to rereformat it to another single data (display only),

Case 1 = 891009125859 (from ID_Patient)
'extract last 4 digits to txtReformat_1 (display only)
Case 2 = 5859 (txtReformat_1)
'reformat data case 2
Case 3 = 9585
'extract data into 3 seperate data to txtModified
txtModified_1 = 5
txtModified_2 = 8
txtModified_3 = 59