Access Form event doesn't work and crashes Access

S

Sayth

I have a basic form which I have previously discussed. However, after reading
further on Access I decided against storing calculated values in my tables so
changed the form.

The short version, 3 bound fields minutes seconds and hundredths return
value to their table. Minutes input mask is 0;;_ and sec & hun 00;;#, as
minutes will never be double digits. I had an unbound form field to display
final input in a "nice" sports format 0:00:00 (never to be calc or used)
just for readability.

The format in the unbound field is

=Format(([TimeMinutes],"0") & Format([TimeSeconds],":""00""") &
Format([TimeHundredths],":""00"""))

I created an event for each bound field.

Private Sub TimeHundredths_AfterUpdate()
Me!TimeHundredths = Nz(Me!TimeHundredths)
End Sub

Private Sub TimeMinutes_AfterUpdate()
Me!TimeMinutes = Nz(Me!TimeMinutes)
End Sub

Private Sub TimeSeconds_AfterUpdate()
Me!TimeSeconds = Nz(Me!TimeSeconds)
End Sub

Issue the time format doesn't display properly and it appears to be causing
access to crash. An access wizard has popped up to advise I hav crashed may
times recently. It completed reapiring 1 error but random crashing when using
form continues.

How can I get format right and not crash access with my bad vba programming?
 
M

Michael J. Strickland

Sayth said:
I have a basic form which I have previously discussed. However, after
reading
further on Access I decided against storing calculated values in my
tables so
changed the form.

The short version, 3 bound fields minutes seconds and hundredths
return
value to their table. Minutes input mask is 0;;_ and sec & hun 00;;#,
as
minutes will never be double digits. I had an unbound form field to
display
final input in a "nice" sports format 0:00:00 (never to be calc or
used)
just for readability.

The format in the unbound field is

=Format(([TimeMinutes],"0") & Format([TimeSeconds],":""00""") &
Format([TimeHundredths],":""00"""))

I created an event for each bound field.

Private Sub TimeHundredths_AfterUpdate()
Me!TimeHundredths = Nz(Me!TimeHundredths)
End Sub

Private Sub TimeMinutes_AfterUpdate()
Me!TimeMinutes = Nz(Me!TimeMinutes)
End Sub

Private Sub TimeSeconds_AfterUpdate()
Me!TimeSeconds = Nz(Me!TimeSeconds)
End Sub

Issue the time format doesn't display properly and it appears to be
causing
access to crash. An access wizard has popped up to advise I hav
crashed may
times recently. It completed reapiring 1 error but random crashing
when using
form continues.

How can I get format right and not crash access with my bad vba
programming?


Try using this for the unbound field:

=Format([TimeMinutes],"0") & ":" & Format([TimeSeconds],"00") &
":" & Format([TimeHundredths],"00")

I think ACCESS may be getting confused by your use of ":" in the format
string since ":" is used by access in a named format string (e.g.
"hh:mm:ss").
 
S

Stu

Hi Sayth - with your VBA you are not specifying what to replace the null
value with - try:

Private Sub TimeMinutes_AfterUpdate()
Me!TimeMinutes = Nz(Me!TimeMinutes,0) ' note the 0
End Sub

with your calculated field try:

=format([timeMinutes],"0") & ":" & format([TimeSeconds],"00") & ":" &
format([TimeHundreths],"00")

Hth,
Stu
 
F

flebber

Awesome that worked a charm, so I forgot to specify the null value. I
need to read up on some more on correct format for strings as well.

An aside since its working why don't we need to specify the 00 null in
the seconds and hundredths fields. So
Private Sub TimeSeconds_AfterUpdate()
Me!TimeSeconds = Nz(Me!TimeSeconds,00)
End Sub

Hi Sayth - with your VBA you are not specifying what to replace the null
value with - try:

Private Sub TimeMinutes_AfterUpdate()
Me!TimeMinutes = Nz(Me!TimeMinutes,0)  ' note the 0
End Sub

with your calculated field try:

=format([timeMinutes],"0") & ":" & format([TimeSeconds],"00") & ":" &
format([TimeHundreths],"00")

Hth,
Stu

Sayth said:
I have a basic form which I have previously discussed. However, after reading
further on Access I decided against storing calculated values in my tables so
changed the form.
The short version, 3 bound fields minutes seconds and hundredths return
value to their table. Minutes input mask is 0;;_ and sec & hun 00;;#, as
minutes will never be double digits. I had an unbound form field to display
final input in a "nice" sports format 0:00:00 (never to be calc or  used)
just for readability.
The format in the unbound field is
=Format(([TimeMinutes],"0") & Format([TimeSeconds],":""00""") &
Format([TimeHundredths],":""00"""))
I created an event for each bound field.
Private Sub TimeHundredths_AfterUpdate()
Me!TimeHundredths = Nz(Me!TimeHundredths)
End Sub
Private Sub TimeMinutes_AfterUpdate()
Me!TimeMinutes = Nz(Me!TimeMinutes)
End Sub
Private Sub TimeSeconds_AfterUpdate()
Me!TimeSeconds = Nz(Me!TimeSeconds)
End Sub
Issue the time format doesn't display properly and it appears to be causing
access to crash. An access wizard has popped up to advise I hav crashedmay
times recently. It completed reapiring 1 error but random crashing whenusing
form continues.
How can I get format right and not crash access with my bad vba programming?
 
R

Risse

"flebber" <[email protected]> kirjoitti
viestissä:161bc0bb-ceff-4588-b9d4-08a00be01330@v27g2000pro.googlegroups.com...
Awesome that worked a charm, so I forgot to specify the null value. I
need to read up on some more on correct format for strings as well.

An aside since its working why don't we need to specify the 00 null in
the seconds and hundredths fields. So
Private Sub TimeSeconds_AfterUpdate()
Me!TimeSeconds = Nz(Me!TimeSeconds,00)
End Sub

Hi Sayth - with your VBA you are not specifying what to replace the null
value with - try:

Private Sub TimeMinutes_AfterUpdate()
Me!TimeMinutes = Nz(Me!TimeMinutes,0) ' note the 0
End Sub

with your calculated field try:

=format([timeMinutes],"0") & ":" & format([TimeSeconds],"00") & ":" &
format([TimeHundreths],"00")

Hth,
Stu

Sayth said:
I have a basic form which I have previously discussed. However, after
reading
further on Access I decided against storing calculated values in my
tables so
changed the form.
The short version, 3 bound fields minutes seconds and hundredths return
value to their table. Minutes input mask is 0;;_ and sec & hun 00;;#, as
minutes will never be double digits. I had an unbound form field to
display
final input in a "nice" sports format 0:00:00 (never to be calc or used)
just for readability.
The format in the unbound field is
=Format(([TimeMinutes],"0") & Format([TimeSeconds],":""00""") &
Format([TimeHundredths],":""00"""))
I created an event for each bound field.
Private Sub TimeHundredths_AfterUpdate()
Me!TimeHundredths = Nz(Me!TimeHundredths)
End Sub
Private Sub TimeMinutes_AfterUpdate()
Me!TimeMinutes = Nz(Me!TimeMinutes)
End Sub
Private Sub TimeSeconds_AfterUpdate()
Me!TimeSeconds = Nz(Me!TimeSeconds)
End Sub
Issue the time format doesn't display properly and it appears to be
causing
access to crash. An access wizard has popped up to advise I hav crashed
may
times recently. It completed reapiring 1 error but random crashing when
using
form continues.
How can I get format right and not crash access with my bad vba
programming?
 

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