Change of iserted time information

  • Thread starter lad5ko via AccessMonster.com
  • Start date
L

lad5ko via AccessMonster.com

hi,

in my database must user in one field write time in format "23:15". It is
most convenient and quick write "23.15" or "23,15" on numeric part of
keyboard. Is it possible write some code which change comma or dot in
semicolon?

Any idea will be appreciated.

lad5ko
 
D

Douglas J. Steele

In the BeforeUpdate event of the control, try something like:

Private Sub MyTextBox_BeforeUpdate(Cancel As Integer)

Me.MyTextBox = Replace(Replace(Me.MyTextBox, ",", ":"), ".", ":")

End Sub

(replace "MyTextBox" with the name of your actual text box.)
 
G

Guest

Hi

If it just that you don't want to hit the semicolon key between typing the
numbers you could simply place this in the input mask row

00:00;0;_

Set the format of the field on the form to Short time.

This will not affect the time/date data is stored just the way it is input
and viewed.

Hope this helps
 
L

lad5ko via AccessMonster.com

Hi Douglas,
I attempted your code and I obtained this error message
„Invalid data for this field.“

„Run-time error ′-2147352567 (80020009)′: event BeforeUpdate hinder Microsoft
Access to save data in this column.

Hi Waine,

your format solution is a good idea, but works just if user write 4 digits
like „0625“, if write „625“ MS Access can not uderstand this information and
this can cause problem.

Anyway thanks for your help.

lad5ko


Wayne-I-M said:
Hi

If it just that you don't want to hit the semicolon key between typing the
numbers you could simply place this in the input mask row

00:00;0;_

Set the format of the field on the form to Short time.

This will not affect the time/date data is stored just the way it is input
and viewed.

Hope this helps
[quoted text clipped - 6 lines]
 
D

Douglas J. Steele

What you may need to do is make the input in an unbound text box, and
transfer the reformatted data to the (hidden) bound text box.

It does get messy in that you also need to transfer the data back to the
unbound text box when you move to a new record.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


lad5ko via AccessMonster.com said:
Hi Douglas,
I attempted your code and I obtained this error message
"Invalid data for this field."

"Run-time error '-2147352567 (80020009)': event BeforeUpdate hinder
Microsoft
Access to save data in this column.

Hi Waine,

your format solution is a good idea, but works just if user write 4 digits
like "0625", if write "625" MS Access can not uderstand this information
and
this can cause problem.

Anyway thanks for your help.

lad5ko


Wayne-I-M said:
Hi

If it just that you don't want to hit the semicolon key between typing the
numbers you could simply place this in the input mask row

00:00;0;_

Set the format of the field on the form to Short time.

This will not affect the time/date data is stored just the way it is input
and viewed.

Hope this helps
[quoted text clipped - 6 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top