format number within text string (1 Viewer)

Davros

Registered User.
Local time
Today, 12:51
Joined
Sep 9, 2005
Messages
131
hi
I'm no expert and can't seem to find what i'm looking for.

i have data i enter into a text box. the data might be in the format

"name"
OR
"name, date, age"
OR
"name, date"

if on the second or third example above i entered the data like shown below how would i VB code the afterupdate to do this:

turn
David Roberts, 12122006
to
David Roberts, 12/12/2006

OR turn
David Roberts, 12122006, 56
to
David Roberts, 12/12/2006, aged 56

any ideas??
I'm working along the lines of instr, mid, etc. but i'm not sure of the correct procedure
thanks in advance
 

Johny

Registered User.
Local time
Today, 13:51
Joined
Jun 1, 2004
Messages
80
Why not entering each data in a separate textfield?
1 for name (restrict to only textinput)
1 for date (set the inputmask to 'short date')
1 for age (restrict to only numerical input and max 99?)
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 12:51
Joined
Sep 12, 2006
Messages
15,656
you ought to have three separate boxes for three distinct fields

having done this, just set the format or input mask for each of the boxes to achieve what you require.

eg with a number, set the mask as
"Aged "###

this will allow you to input a 3 figure number max, stored as the number, but displayed as eg Aged 56

look in help at inputmask and format
 

Davros

Registered User.
Local time
Today, 12:51
Joined
Sep 9, 2005
Messages
131
thanks for replying
this text box in my record serves no data purpose whatsoever except for me to see that i have correctly matched a photograph to the actual record.
all the information in this text box is contained elsewhere in seperate fields.
this is not actually a problem but seeing that i have thousands of records to create it would save me some time.
the orignal problem still stands.
how would i go about solving it?
 

boblarson

Smeghead
Local time
Today, 04:51
Joined
Jan 12, 2001
Messages
32,059
If you are storing the items in other fields, don't try to add that field, just display a text box that concatenates from the other fields for your display purposes.

Also, you wouldn't use the AfterUpdate event to change the input anyway. You would use the BeforeUpdate, otherwise you could end up in a perpetual loop. The AfterUpdate of a control should NEVER be used to revise data in that control that has just been saved.
 

Davros

Registered User.
Local time
Today, 12:51
Joined
Sep 9, 2005
Messages
131
the original problem still stands.
boblarson - you are reading the question backwards. i do not need the data to identify the photograph even though the data is correctley stored in another table. i need the data that i collect in the 'field' to confirm that i have matched the correct photograph. the data in the 'field' does not nessasaraly match the data i have in my database.
this question is about saving time entering the data NOT about entering it correctly. i have entered it correctly in another table. when i match the tables up with the data i have collected in the 'field' it might or might not match - i cannot tell untill i have looked at the photograph AND the table that contains the book data. BUT the right photograph must be matched up to the record hence the text box with an inscription in it that might or might not have
name, date of birth, date of death, age
so the original question still stands.
I repeat - i have entered the data correctly but not in the table that i use for storing information that i have collected from the 'field'
 

Users who are viewing this thread

Top Bottom