Command button click initiating series of events . . .

G

Guest

Pardon the following "slop", but I'm new at this. I have a database
whose main table has 8 of 11 fields filled in by a report. I am
attempting to update the remaining 3 fields (start time, finish time,
and balanced) based on the input from a form. For the start and finish
times, I have created command buttons for the following purposes. For
the start time command button, I only want it "clickable" if the start
time field is empty. Once clicked, I would like a message box to
prompt the user to verify they are ready to start, then, if they click
"OK" to record that time in the start time field, disable the start
command button, and update the form. I have made the following attempt
at a private sub:

Private Sub Start_Click()
Dim intResponse As Integer
intResponse = MsgBox(Prompt:="The start time can NOT be changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End Sub


It works, but it disables all of the start times in the form instead of
just the one clicked. (The form contains any number of records). I'm
attempting to handle the refresh from a private OnUpdate sub in the
Start Time field.


I haven't attempted the Finsh command button yet, but would like a
message of "Is the tracer in balance?" to update the check box and, if
the answer is yes, to update the form without that record showing.


Any and all comments and suggestions are greatly appreciated. If more
information is needed, please just let me know.


Thank you,


A
 
G

Guest

Based on your post, it appears your form is in datasheet view. You can
expect this to happen in Datasheet view. Change your form to continuous view
and I think the problem will go away.
 
G

Guest

Klatuu,

Thank you very much for the quick response. I checked the form and I had it
set to "continuous form view". I've tried the following "amendment":

Private Sub Start_Click()
Dim intStartResponse As Integer
If IsMissing("txtStartTime") = True Then
intStartResponse = MsgBox(Prompt:="The start time can NOT be changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intStartResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Else
End If
Else
If IsEmpty("txtStartTime") = False Then
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End If
End Sub

But it disables the "Start" command button and does not record the time even
though "txtStartTime" is blank. {That may be my problem - i'm thinking of
excel - if(isblank(. . . . }. Would a while or with work better? If so,
would you please sketch it out for me.

Thank you again,

A

Klatuu said:
Based on your post, it appears your form is in datasheet view. You can
expect this to happen in Datasheet view. Change your form to continuous view
and I think the problem will go away.

asaylor said:
Pardon the following "slop", but I'm new at this. I have a database
whose main table has 8 of 11 fields filled in by a report. I am
attempting to update the remaining 3 fields (start time, finish time,
and balanced) based on the input from a form. For the start and finish
times, I have created command buttons for the following purposes. For
the start time command button, I only want it "clickable" if the start
time field is empty. Once clicked, I would like a message box to
prompt the user to verify they are ready to start, then, if they click
"OK" to record that time in the start time field, disable the start
command button, and update the form. I have made the following attempt
at a private sub:

Private Sub Start_Click()
Dim intResponse As Integer
intResponse = MsgBox(Prompt:="The start time can NOT be changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End Sub


It works, but it disables all of the start times in the form instead of
just the one clicked. (The form contains any number of records). I'm
attempting to handle the refresh from a private OnUpdate sub in the
Start Time field.


I haven't attempted the Finsh command button yet, but would like a
message of "Is the tracer in balance?" to update the check box and, if
the answer is yes, to update the form without that record showing.


Any and all comments and suggestions are greatly appreciated. If more
information is needed, please just let me know.


Thank you,


A
 
M

missinglinq via AccessMonster.com

Going back to your original code, the problem is that you're setting Me.Start.
Enabled = False and then never doing anything to change it back. Each time
you move to a different record, you need to check the [Start_Time] field and
see whether it's blank or not. If it's blank set Me.Start.Enabled = True, if
it already has a start time filled in set Me.Start.Enabled = False. The
Form_Current sub is the place to do this; each time a new record gains focus,
if you will, this sub is invoked.

Private Sub Form_Current()
If IsNull(Me![Start_Time]) Then
Me.Start.Enabled = True
Else
Me.Start.Enabled = False
End If
End Sub

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
G

Guest

There are two function you are using that are really only meant for Variant
variables. The IsMissing function is used to determine whether an optional
argument in a function or sub has been received. Also, you are not testing
the value of txtStartTime, you are testing a literal string.
If IsMissing("txtStartTime") = True Then

To determine whether a control has had anything entered, the ususal method is:
If IsNull(Me.txtStartTime) = True Then

The IsEmpty function is really only useful for variants.
If IsEmpty("txtStartTime") = False Then
This should be
If IsNull(Me.txtStartTime) = False Then

Rather than enabling and disabling the controls, If you set them both to
Enabled = No and Locked = Yes, Then they cannot accept the focus, but you can
change them with the code in the command buttons.

I would set the Enabled property of the Finish button to No in design view
and only enable it after a start time has been entered. You can use the Form
Current event to Disable it for the next record.

Here is the code the way (IMHO) it should be:


Private Sub Start_Click()

If IsNull(Me.[Start_Time]) Then
If MsgBox("The start time can NOT be changed. Only Click OK if you
" & _
are ready to balance!", vbOKCancel + vbExclamation + _
vbDefaultButton2, "WARNING") = vbOk Then
Me.[Start_Time] = Time()
ME.Finish.Enabled = True
Me.Finish.SetFocus
Me.Start.Enabled = False
End If
Else
MsgBox("The start time can NOT be changed.", vbExclamation, "WARNING")
End If

End Sub


Private Sub Finish_Click()
Dim sngTimeDiff As Single

If IsNull(Me.Finish_Time) Then
Me.[Finish_Time] = Time()
lngTimeDiff = Datediff("s", Me.Start_Time, Me.Finish_Time)
Me.TotalTime = Format(lngTimeDiff \ 60, "00:") & _
Format(lngTimeDiff Mod 60,"00")
Else
MsgBox("The Finish time can NOT be changed.", _
vbExclamation, "WARNING")
End If

End Sub

Private Sub Form_Current()

Me.Start.Enabled = True
Me.Finish.Enabled = False

End Sub
asaylor said:
Klatuu,

Thank you very much for the quick response. I checked the form and I had it
set to "continuous form view". I've tried the following "amendment":

Private Sub Start_Click()
Dim intStartResponse As Integer
If IsMissing("txtStartTime") = True Then
intStartResponse = MsgBox(Prompt:="The start time can NOT be changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intStartResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Else
End If
Else
If IsEmpty("txtStartTime") = False Then
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End If
End Sub

But it disables the "Start" command button and does not record the time even
though "txtStartTime" is blank. {That may be my problem - i'm thinking of
excel - if(isblank(. . . . }. Would a while or with work better? If so,
would you please sketch it out for me.

Thank you again,

A

Klatuu said:
Based on your post, it appears your form is in datasheet view. You can
expect this to happen in Datasheet view. Change your form to continuous view
and I think the problem will go away.

asaylor said:
Pardon the following "slop", but I'm new at this. I have a database
whose main table has 8 of 11 fields filled in by a report. I am
attempting to update the remaining 3 fields (start time, finish time,
and balanced) based on the input from a form. For the start and finish
times, I have created command buttons for the following purposes. For
the start time command button, I only want it "clickable" if the start
time field is empty. Once clicked, I would like a message box to
prompt the user to verify they are ready to start, then, if they click
"OK" to record that time in the start time field, disable the start
command button, and update the form. I have made the following attempt
at a private sub:

Private Sub Start_Click()
Dim intResponse As Integer
intResponse = MsgBox(Prompt:="The start time can NOT be changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End Sub


It works, but it disables all of the start times in the form instead of
just the one clicked. (The form contains any number of records). I'm
attempting to handle the refresh from a private OnUpdate sub in the
Start Time field.


I haven't attempted the Finsh command button yet, but would like a
message of "Is the tracer in balance?" to update the check box and, if
the answer is yes, to update the form without that record showing.


Any and all comments and suggestions are greatly appreciated. If more
information is needed, please just let me know.


Thank you,


A
 
G

Guest

Klatuu and missinglinq,

Thank you very much for taking the time to explain my "logic" errors. I
used the code provided by Klatuu and it works very well. I have, however,
one follow up, if either of you have time. I can't enter anything in the ID
field in the form and am not sure why. I have Locked = No and Enabled = Yes,
but still can't enter numbers or letters.

Thank you again for all the help.

Klatuu said:
There are two function you are using that are really only meant for Variant
variables. The IsMissing function is used to determine whether an optional
argument in a function or sub has been received. Also, you are not testing
the value of txtStartTime, you are testing a literal string.
If IsMissing("txtStartTime") = True Then

To determine whether a control has had anything entered, the ususal method is:
If IsNull(Me.txtStartTime) = True Then

The IsEmpty function is really only useful for variants.
If IsEmpty("txtStartTime") = False Then
This should be
If IsNull(Me.txtStartTime) = False Then

Rather than enabling and disabling the controls, If you set them both to
Enabled = No and Locked = Yes, Then they cannot accept the focus, but you can
change them with the code in the command buttons.

I would set the Enabled property of the Finish button to No in design view
and only enable it after a start time has been entered. You can use the Form
Current event to Disable it for the next record.

Here is the code the way (IMHO) it should be:


Private Sub Start_Click()

If IsNull(Me.[Start_Time]) Then
If MsgBox("The start time can NOT be changed. Only Click OK if you
" & _
are ready to balance!", vbOKCancel + vbExclamation + _
vbDefaultButton2, "WARNING") = vbOk Then
Me.[Start_Time] = Time()
ME.Finish.Enabled = True
Me.Finish.SetFocus
Me.Start.Enabled = False
End If
Else
MsgBox("The start time can NOT be changed.", vbExclamation, "WARNING")
End If

End Sub


Private Sub Finish_Click()
Dim sngTimeDiff As Single

If IsNull(Me.Finish_Time) Then
Me.[Finish_Time] = Time()
lngTimeDiff = Datediff("s", Me.Start_Time, Me.Finish_Time)
Me.TotalTime = Format(lngTimeDiff \ 60, "00:") & _
Format(lngTimeDiff Mod 60,"00")
Else
MsgBox("The Finish time can NOT be changed.", _
vbExclamation, "WARNING")
End If

End Sub

Private Sub Form_Current()

Me.Start.Enabled = True
Me.Finish.Enabled = False

End Sub
asaylor said:
Klatuu,

Thank you very much for the quick response. I checked the form and I had it
set to "continuous form view". I've tried the following "amendment":

Private Sub Start_Click()
Dim intStartResponse As Integer
If IsMissing("txtStartTime") = True Then
intStartResponse = MsgBox(Prompt:="The start time can NOT be changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intStartResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Else
End If
Else
If IsEmpty("txtStartTime") = False Then
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End If
End Sub

But it disables the "Start" command button and does not record the time even
though "txtStartTime" is blank. {That may be my problem - i'm thinking of
excel - if(isblank(. . . . }. Would a while or with work better? If so,
would you please sketch it out for me.

Thank you again,

A

Klatuu said:
Based on your post, it appears your form is in datasheet view. You can
expect this to happen in Datasheet view. Change your form to continuous view
and I think the problem will go away.

:

Pardon the following "slop", but I'm new at this. I have a database
whose main table has 8 of 11 fields filled in by a report. I am
attempting to update the remaining 3 fields (start time, finish time,
and balanced) based on the input from a form. For the start and finish
times, I have created command buttons for the following purposes. For
the start time command button, I only want it "clickable" if the start
time field is empty. Once clicked, I would like a message box to
prompt the user to verify they are ready to start, then, if they click
"OK" to record that time in the start time field, disable the start
command button, and update the form. I have made the following attempt
at a private sub:

Private Sub Start_Click()
Dim intResponse As Integer
intResponse = MsgBox(Prompt:="The start time can NOT be changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End Sub


It works, but it disables all of the start times in the form instead of
just the one clicked. (The form contains any number of records). I'm
attempting to handle the refresh from a private OnUpdate sub in the
Start Time field.


I haven't attempted the Finsh command button yet, but would like a
message of "Is the tracer in balance?" to update the check box and, if
the answer is yes, to update the form without that record showing.


Any and all comments and suggestions are greatly appreciated. If more
information is needed, please just let me know.


Thank you,


A
 
G

Guest

I really can't tell without some information about the control. Is it bound
to a field in the recordset? Is the recordset a query or a table? if it is a
query, is the query based on multiple tables and or queries? Are there any
other controls on your form you can't enter anything into?

asaylor said:
Klatuu and missinglinq,

Thank you very much for taking the time to explain my "logic" errors. I
used the code provided by Klatuu and it works very well. I have, however,
one follow up, if either of you have time. I can't enter anything in the ID
field in the form and am not sure why. I have Locked = No and Enabled = Yes,
but still can't enter numbers or letters.

Thank you again for all the help.

Klatuu said:
There are two function you are using that are really only meant for Variant
variables. The IsMissing function is used to determine whether an optional
argument in a function or sub has been received. Also, you are not testing
the value of txtStartTime, you are testing a literal string.
If IsMissing("txtStartTime") = True Then

To determine whether a control has had anything entered, the ususal method is:
If IsNull(Me.txtStartTime) = True Then

The IsEmpty function is really only useful for variants.
If IsEmpty("txtStartTime") = False Then
This should be
If IsNull(Me.txtStartTime) = False Then

Rather than enabling and disabling the controls, If you set them both to
Enabled = No and Locked = Yes, Then they cannot accept the focus, but you can
change them with the code in the command buttons.

I would set the Enabled property of the Finish button to No in design view
and only enable it after a start time has been entered. You can use the Form
Current event to Disable it for the next record.

Here is the code the way (IMHO) it should be:


Private Sub Start_Click()

If IsNull(Me.[Start_Time]) Then
If MsgBox("The start time can NOT be changed. Only Click OK if you
" & _
are ready to balance!", vbOKCancel + vbExclamation + _
vbDefaultButton2, "WARNING") = vbOk Then
Me.[Start_Time] = Time()
ME.Finish.Enabled = True
Me.Finish.SetFocus
Me.Start.Enabled = False
End If
Else
MsgBox("The start time can NOT be changed.", vbExclamation, "WARNING")
End If

End Sub


Private Sub Finish_Click()
Dim sngTimeDiff As Single

If IsNull(Me.Finish_Time) Then
Me.[Finish_Time] = Time()
lngTimeDiff = Datediff("s", Me.Start_Time, Me.Finish_Time)
Me.TotalTime = Format(lngTimeDiff \ 60, "00:") & _
Format(lngTimeDiff Mod 60,"00")
Else
MsgBox("The Finish time can NOT be changed.", _
vbExclamation, "WARNING")
End If

End Sub

Private Sub Form_Current()

Me.Start.Enabled = True
Me.Finish.Enabled = False

End Sub
asaylor said:
Klatuu,

Thank you very much for the quick response. I checked the form and I had it
set to "continuous form view". I've tried the following "amendment":

Private Sub Start_Click()
Dim intStartResponse As Integer
If IsMissing("txtStartTime") = True Then
intStartResponse = MsgBox(Prompt:="The start time can NOT be changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intStartResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Else
End If
Else
If IsEmpty("txtStartTime") = False Then
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End If
End Sub

But it disables the "Start" command button and does not record the time even
though "txtStartTime" is blank. {That may be my problem - i'm thinking of
excel - if(isblank(. . . . }. Would a while or with work better? If so,
would you please sketch it out for me.

Thank you again,

A

:

Based on your post, it appears your form is in datasheet view. You can
expect this to happen in Datasheet view. Change your form to continuous view
and I think the problem will go away.

:

Pardon the following "slop", but I'm new at this. I have a database
whose main table has 8 of 11 fields filled in by a report. I am
attempting to update the remaining 3 fields (start time, finish time,
and balanced) based on the input from a form. For the start and finish
times, I have created command buttons for the following purposes. For
the start time command button, I only want it "clickable" if the start
time field is empty. Once clicked, I would like a message box to
prompt the user to verify they are ready to start, then, if they click
"OK" to record that time in the start time field, disable the start
command button, and update the form. I have made the following attempt
at a private sub:

Private Sub Start_Click()
Dim intResponse As Integer
intResponse = MsgBox(Prompt:="The start time can NOT be changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End Sub


It works, but it disables all of the start times in the form instead of
just the one clicked. (The form contains any number of records). I'm
attempting to handle the refresh from a private OnUpdate sub in the
Start Time field.


I haven't attempted the Finsh command button yet, but would like a
message of "Is the tracer in balance?" to update the check box and, if
the answer is yes, to update the form without that record showing.


Any and all comments and suggestions are greatly appreciated. If more
information is needed, please just let me know.


Thank you,


A
 
G

Guest

Klatuu,

Pardon the delay. I fixed the issue by looking in the Form Properties and
setting Allow Edits = Yes and Data Entry = Yes; so forgive me for wasting
time/energy with that random question. Once again, thank you for the help
and the clarity of your explanation. If you can, do you have a
book/reference that you would recommend for Access?

Klatuu said:
I really can't tell without some information about the control. Is it bound
to a field in the recordset? Is the recordset a query or a table? if it is a
query, is the query based on multiple tables and or queries? Are there any
other controls on your form you can't enter anything into?

asaylor said:
Klatuu and missinglinq,

Thank you very much for taking the time to explain my "logic" errors. I
used the code provided by Klatuu and it works very well. I have, however,
one follow up, if either of you have time. I can't enter anything in the ID
field in the form and am not sure why. I have Locked = No and Enabled = Yes,
but still can't enter numbers or letters.

Thank you again for all the help.

Klatuu said:
There are two function you are using that are really only meant for Variant
variables. The IsMissing function is used to determine whether an optional
argument in a function or sub has been received. Also, you are not testing
the value of txtStartTime, you are testing a literal string.
If IsMissing("txtStartTime") = True Then

To determine whether a control has had anything entered, the ususal method is:
If IsNull(Me.txtStartTime) = True Then

The IsEmpty function is really only useful for variants.
If IsEmpty("txtStartTime") = False Then
This should be
If IsNull(Me.txtStartTime) = False Then

Rather than enabling and disabling the controls, If you set them both to
Enabled = No and Locked = Yes, Then they cannot accept the focus, but you can
change them with the code in the command buttons.

I would set the Enabled property of the Finish button to No in design view
and only enable it after a start time has been entered. You can use the Form
Current event to Disable it for the next record.

Here is the code the way (IMHO) it should be:


Private Sub Start_Click()

If IsNull(Me.[Start_Time]) Then
If MsgBox("The start time can NOT be changed. Only Click OK if you
" & _
are ready to balance!", vbOKCancel + vbExclamation + _
vbDefaultButton2, "WARNING") = vbOk Then
Me.[Start_Time] = Time()
ME.Finish.Enabled = True
Me.Finish.SetFocus
Me.Start.Enabled = False
End If
Else
MsgBox("The start time can NOT be changed.", vbExclamation, "WARNING")
End If

End Sub


Private Sub Finish_Click()
Dim sngTimeDiff As Single

If IsNull(Me.Finish_Time) Then
Me.[Finish_Time] = Time()
lngTimeDiff = Datediff("s", Me.Start_Time, Me.Finish_Time)
Me.TotalTime = Format(lngTimeDiff \ 60, "00:") & _
Format(lngTimeDiff Mod 60,"00")
Else
MsgBox("The Finish time can NOT be changed.", _
vbExclamation, "WARNING")
End If

End Sub

Private Sub Form_Current()

Me.Start.Enabled = True
Me.Finish.Enabled = False

End Sub
:

Klatuu,

Thank you very much for the quick response. I checked the form and I had it
set to "continuous form view". I've tried the following "amendment":

Private Sub Start_Click()
Dim intStartResponse As Integer
If IsMissing("txtStartTime") = True Then
intStartResponse = MsgBox(Prompt:="The start time can NOT be changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intStartResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Else
End If
Else
If IsEmpty("txtStartTime") = False Then
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End If
End Sub

But it disables the "Start" command button and does not record the time even
though "txtStartTime" is blank. {That may be my problem - i'm thinking of
excel - if(isblank(. . . . }. Would a while or with work better? If so,
would you please sketch it out for me.

Thank you again,

A

:

Based on your post, it appears your form is in datasheet view. You can
expect this to happen in Datasheet view. Change your form to continuous view
and I think the problem will go away.

:

Pardon the following "slop", but I'm new at this. I have a database
whose main table has 8 of 11 fields filled in by a report. I am
attempting to update the remaining 3 fields (start time, finish time,
and balanced) based on the input from a form. For the start and finish
times, I have created command buttons for the following purposes. For
the start time command button, I only want it "clickable" if the start
time field is empty. Once clicked, I would like a message box to
prompt the user to verify they are ready to start, then, if they click
"OK" to record that time in the start time field, disable the start
command button, and update the form. I have made the following attempt
at a private sub:

Private Sub Start_Click()
Dim intResponse As Integer
intResponse = MsgBox(Prompt:="The start time can NOT be changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End Sub


It works, but it disables all of the start times in the form instead of
just the one clicked. (The form contains any number of records). I'm
attempting to handle the refresh from a private OnUpdate sub in the
Start Time field.


I haven't attempted the Finsh command button yet, but would like a
message of "Is the tracer in balance?" to update the check box and, if
the answer is yes, to update the form without that record showing.


Any and all comments and suggestions are greatly appreciated. If more
information is needed, please just let me know.


Thank you,


A
 
G

Guest

My favorite is "Access 2002 Desktop Developer's Handbook" by Paul Litwin, Ken
Getz, and Mike Gunderloy, published by Sybex (www.sybex.com). There is a
companion book, "Access 2002 Enterprise Developer's Handbook". The sad part
is, it will be the last. There is no plan to update for 2003, I don't know
about 2007.

It is aimed at the Intermediate/Advanced user, but is a very valuable how to
and why resource.

I don't know if it is still available from the publisher. I got mine from a
used book store.

asaylor said:
Klatuu,

Pardon the delay. I fixed the issue by looking in the Form Properties and
setting Allow Edits = Yes and Data Entry = Yes; so forgive me for wasting
time/energy with that random question. Once again, thank you for the help
and the clarity of your explanation. If you can, do you have a
book/reference that you would recommend for Access?

Klatuu said:
I really can't tell without some information about the control. Is it bound
to a field in the recordset? Is the recordset a query or a table? if it is a
query, is the query based on multiple tables and or queries? Are there any
other controls on your form you can't enter anything into?

asaylor said:
Klatuu and missinglinq,

Thank you very much for taking the time to explain my "logic" errors. I
used the code provided by Klatuu and it works very well. I have, however,
one follow up, if either of you have time. I can't enter anything in the ID
field in the form and am not sure why. I have Locked = No and Enabled = Yes,
but still can't enter numbers or letters.

Thank you again for all the help.

:

There are two function you are using that are really only meant for Variant
variables. The IsMissing function is used to determine whether an optional
argument in a function or sub has been received. Also, you are not testing
the value of txtStartTime, you are testing a literal string.
If IsMissing("txtStartTime") = True Then

To determine whether a control has had anything entered, the ususal method is:
If IsNull(Me.txtStartTime) = True Then

The IsEmpty function is really only useful for variants.
If IsEmpty("txtStartTime") = False Then
This should be
If IsNull(Me.txtStartTime) = False Then

Rather than enabling and disabling the controls, If you set them both to
Enabled = No and Locked = Yes, Then they cannot accept the focus, but you can
change them with the code in the command buttons.

I would set the Enabled property of the Finish button to No in design view
and only enable it after a start time has been entered. You can use the Form
Current event to Disable it for the next record.

Here is the code the way (IMHO) it should be:


Private Sub Start_Click()

If IsNull(Me.[Start_Time]) Then
If MsgBox("The start time can NOT be changed. Only Click OK if you
" & _
are ready to balance!", vbOKCancel + vbExclamation + _
vbDefaultButton2, "WARNING") = vbOk Then
Me.[Start_Time] = Time()
ME.Finish.Enabled = True
Me.Finish.SetFocus
Me.Start.Enabled = False
End If
Else
MsgBox("The start time can NOT be changed.", vbExclamation, "WARNING")
End If

End Sub


Private Sub Finish_Click()
Dim sngTimeDiff As Single

If IsNull(Me.Finish_Time) Then
Me.[Finish_Time] = Time()
lngTimeDiff = Datediff("s", Me.Start_Time, Me.Finish_Time)
Me.TotalTime = Format(lngTimeDiff \ 60, "00:") & _
Format(lngTimeDiff Mod 60,"00")
Else
MsgBox("The Finish time can NOT be changed.", _
vbExclamation, "WARNING")
End If

End Sub

Private Sub Form_Current()

Me.Start.Enabled = True
Me.Finish.Enabled = False

End Sub
:

Klatuu,

Thank you very much for the quick response. I checked the form and I had it
set to "continuous form view". I've tried the following "amendment":

Private Sub Start_Click()
Dim intStartResponse As Integer
If IsMissing("txtStartTime") = True Then
intStartResponse = MsgBox(Prompt:="The start time can NOT be changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intStartResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Else
End If
Else
If IsEmpty("txtStartTime") = False Then
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End If
End Sub

But it disables the "Start" command button and does not record the time even
though "txtStartTime" is blank. {That may be my problem - i'm thinking of
excel - if(isblank(. . . . }. Would a while or with work better? If so,
would you please sketch it out for me.

Thank you again,

A

:

Based on your post, it appears your form is in datasheet view. You can
expect this to happen in Datasheet view. Change your form to continuous view
and I think the problem will go away.

:

Pardon the following "slop", but I'm new at this. I have a database
whose main table has 8 of 11 fields filled in by a report. I am
attempting to update the remaining 3 fields (start time, finish time,
and balanced) based on the input from a form. For the start and finish
times, I have created command buttons for the following purposes. For
the start time command button, I only want it "clickable" if the start
time field is empty. Once clicked, I would like a message box to
prompt the user to verify they are ready to start, then, if they click
"OK" to record that time in the start time field, disable the start
command button, and update the form. I have made the following attempt
at a private sub:

Private Sub Start_Click()
Dim intResponse As Integer
intResponse = MsgBox(Prompt:="The start time can NOT be changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End Sub


It works, but it disables all of the start times in the form instead of
just the one clicked. (The form contains any number of records). I'm
attempting to handle the refresh from a private OnUpdate sub in the
Start Time field.


I haven't attempted the Finsh command button yet, but would like a
message of "Is the tracer in balance?" to update the check box and, if
the answer is yes, to update the form without that record showing.


Any and all comments and suggestions are greatly appreciated. If more
information is needed, please just let me know.


Thank you,


A
 
D

Douglas J. Steele

For more details about these books, take a look at
http://www.developershandbook.com

I know that they didn't produce an Access 2003 because it was felt that the
differences between Access 2002 and Access 2003 weren't sufficient enough to
warrant a new book.

The differences between Access 2003 and Access 2007, however, are
monumental. While I haven't heard whether they're planning a new book, I'd
have to think there's a need for one.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Klatuu said:
My favorite is "Access 2002 Desktop Developer's Handbook" by Paul Litwin,
Ken
Getz, and Mike Gunderloy, published by Sybex (www.sybex.com). There is a
companion book, "Access 2002 Enterprise Developer's Handbook". The sad
part
is, it will be the last. There is no plan to update for 2003, I don't
know
about 2007.

It is aimed at the Intermediate/Advanced user, but is a very valuable how
to
and why resource.

I don't know if it is still available from the publisher. I got mine from
a
used book store.

asaylor said:
Klatuu,

Pardon the delay. I fixed the issue by looking in the Form Properties
and
setting Allow Edits = Yes and Data Entry = Yes; so forgive me for wasting
time/energy with that random question. Once again, thank you for the
help
and the clarity of your explanation. If you can, do you have a
book/reference that you would recommend for Access?

Klatuu said:
I really can't tell without some information about the control. Is it
bound
to a field in the recordset? Is the recordset a query or a table? if
it is a
query, is the query based on multiple tables and or queries? Are there
any
other controls on your form you can't enter anything into?

:

Klatuu and missinglinq,

Thank you very much for taking the time to explain my "logic" errors.
I
used the code provided by Klatuu and it works very well. I have,
however,
one follow up, if either of you have time. I can't enter anything in
the ID
field in the form and am not sure why. I have Locked = No and
Enabled = Yes,
but still can't enter numbers or letters.

Thank you again for all the help.

:

There are two function you are using that are really only meant for
Variant
variables. The IsMissing function is used to determine whether an
optional
argument in a function or sub has been received. Also, you are not
testing
the value of txtStartTime, you are testing a literal string.
If IsMissing("txtStartTime") = True Then

To determine whether a control has had anything entered, the ususal
method is:
If IsNull(Me.txtStartTime) = True Then

The IsEmpty function is really only useful for variants.
If IsEmpty("txtStartTime") = False Then
This should be
If IsNull(Me.txtStartTime) = False Then

Rather than enabling and disabling the controls, If you set them
both to
Enabled = No and Locked = Yes, Then they cannot accept the focus,
but you can
change them with the code in the command buttons.

I would set the Enabled property of the Finish button to No in
design view
and only enable it after a start time has been entered. You can
use the Form
Current event to Disable it for the next record.

Here is the code the way (IMHO) it should be:


Private Sub Start_Click()

If IsNull(Me.[Start_Time]) Then
If MsgBox("The start time can NOT be changed. Only Click
OK if you
" & _
are ready to balance!", vbOKCancel + vbExclamation
+ _
vbDefaultButton2, "WARNING") = vbOk Then
Me.[Start_Time] = Time()
ME.Finish.Enabled = True
Me.Finish.SetFocus
Me.Start.Enabled = False
End If
Else
MsgBox("The start time can NOT be changed.", vbExclamation,
"WARNING")
End If

End Sub


Private Sub Finish_Click()
Dim sngTimeDiff As Single

If IsNull(Me.Finish_Time) Then
Me.[Finish_Time] = Time()
lngTimeDiff = Datediff("s", Me.Start_Time, Me.Finish_Time)
Me.TotalTime = Format(lngTimeDiff \ 60, "00:") & _
Format(lngTimeDiff Mod 60,"00")
Else
MsgBox("The Finish time can NOT be changed.", _
vbExclamation, "WARNING")
End If

End Sub

Private Sub Form_Current()

Me.Start.Enabled = True
Me.Finish.Enabled = False

End Sub
:

Klatuu,

Thank you very much for the quick response. I checked the form
and I had it
set to "continuous form view". I've tried the following
"amendment":

Private Sub Start_Click()
Dim intStartResponse As Integer
If IsMissing("txtStartTime") = True Then
intStartResponse = MsgBox(Prompt:="The start time can NOT be
changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intStartResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Else
End If
Else
If IsEmpty("txtStartTime") = False Then
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End If
End Sub

But it disables the "Start" command button and does not record
the time even
though "txtStartTime" is blank. {That may be my problem - i'm
thinking of
excel - if(isblank(. . . . }. Would a while or with work better?
If so,
would you please sketch it out for me.

Thank you again,

A

:

Based on your post, it appears your form is in datasheet view.
You can
expect this to happen in Datasheet view. Change your form to
continuous view
and I think the problem will go away.

:

Pardon the following "slop", but I'm new at this. I have a
database
whose main table has 8 of 11 fields filled in by a report. I
am
attempting to update the remaining 3 fields (start time,
finish time,
and balanced) based on the input from a form. For the start
and finish
times, I have created command buttons for the following
purposes. For
the start time command button, I only want it "clickable" if
the start
time field is empty. Once clicked, I would like a message
box to
prompt the user to verify they are ready to start, then, if
they click
"OK" to record that time in the start time field, disable the
start
command button, and update the form. I have made the
following attempt
at a private sub:

Private Sub Start_Click()
Dim intResponse As Integer
intResponse = MsgBox(Prompt:="The start time can NOT be
changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation +
vbDefaultButton2,
Title:="WARNING")
If intResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End Sub


It works, but it disables all of the start times in the form
instead of
just the one clicked. (The form contains any number of
records). I'm
attempting to handle the refresh from a private OnUpdate sub
in the
Start Time field.


I haven't attempted the Finsh command button yet, but would
like a
message of "Is the tracer in balance?" to update the check
box and, if
the answer is yes, to update the form without that record
showing.


Any and all comments and suggestions are greatly appreciated.
If more
information is needed, please just let me know.


Thank you,


A
 
G

Guest

I hope they do. It is the book I turn to first.

Douglas J. Steele said:
For more details about these books, take a look at
http://www.developershandbook.com

I know that they didn't produce an Access 2003 because it was felt that the
differences between Access 2002 and Access 2003 weren't sufficient enough to
warrant a new book.

The differences between Access 2003 and Access 2007, however, are
monumental. While I haven't heard whether they're planning a new book, I'd
have to think there's a need for one.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Klatuu said:
My favorite is "Access 2002 Desktop Developer's Handbook" by Paul Litwin,
Ken
Getz, and Mike Gunderloy, published by Sybex (www.sybex.com). There is a
companion book, "Access 2002 Enterprise Developer's Handbook". The sad
part
is, it will be the last. There is no plan to update for 2003, I don't
know
about 2007.

It is aimed at the Intermediate/Advanced user, but is a very valuable how
to
and why resource.

I don't know if it is still available from the publisher. I got mine from
a
used book store.

asaylor said:
Klatuu,

Pardon the delay. I fixed the issue by looking in the Form Properties
and
setting Allow Edits = Yes and Data Entry = Yes; so forgive me for wasting
time/energy with that random question. Once again, thank you for the
help
and the clarity of your explanation. If you can, do you have a
book/reference that you would recommend for Access?

:

I really can't tell without some information about the control. Is it
bound
to a field in the recordset? Is the recordset a query or a table? if
it is a
query, is the query based on multiple tables and or queries? Are there
any
other controls on your form you can't enter anything into?

:

Klatuu and missinglinq,

Thank you very much for taking the time to explain my "logic" errors.
I
used the code provided by Klatuu and it works very well. I have,
however,
one follow up, if either of you have time. I can't enter anything in
the ID
field in the form and am not sure why. I have Locked = No and
Enabled = Yes,
but still can't enter numbers or letters.

Thank you again for all the help.

:

There are two function you are using that are really only meant for
Variant
variables. The IsMissing function is used to determine whether an
optional
argument in a function or sub has been received. Also, you are not
testing
the value of txtStartTime, you are testing a literal string.
If IsMissing("txtStartTime") = True Then

To determine whether a control has had anything entered, the ususal
method is:
If IsNull(Me.txtStartTime) = True Then

The IsEmpty function is really only useful for variants.
If IsEmpty("txtStartTime") = False Then
This should be
If IsNull(Me.txtStartTime) = False Then

Rather than enabling and disabling the controls, If you set them
both to
Enabled = No and Locked = Yes, Then they cannot accept the focus,
but you can
change them with the code in the command buttons.

I would set the Enabled property of the Finish button to No in
design view
and only enable it after a start time has been entered. You can
use the Form
Current event to Disable it for the next record.

Here is the code the way (IMHO) it should be:


Private Sub Start_Click()

If IsNull(Me.[Start_Time]) Then
If MsgBox("The start time can NOT be changed. Only Click
OK if you
" & _
are ready to balance!", vbOKCancel + vbExclamation
+ _
vbDefaultButton2, "WARNING") = vbOk Then
Me.[Start_Time] = Time()
ME.Finish.Enabled = True
Me.Finish.SetFocus
Me.Start.Enabled = False
End If
Else
MsgBox("The start time can NOT be changed.", vbExclamation,
"WARNING")
End If

End Sub


Private Sub Finish_Click()
Dim sngTimeDiff As Single

If IsNull(Me.Finish_Time) Then
Me.[Finish_Time] = Time()
lngTimeDiff = Datediff("s", Me.Start_Time, Me.Finish_Time)
Me.TotalTime = Format(lngTimeDiff \ 60, "00:") & _
Format(lngTimeDiff Mod 60,"00")
Else
MsgBox("The Finish time can NOT be changed.", _
vbExclamation, "WARNING")
End If

End Sub

Private Sub Form_Current()

Me.Start.Enabled = True
Me.Finish.Enabled = False

End Sub
:

Klatuu,

Thank you very much for the quick response. I checked the form
and I had it
set to "continuous form view". I've tried the following
"amendment":

Private Sub Start_Click()
Dim intStartResponse As Integer
If IsMissing("txtStartTime") = True Then
intStartResponse = MsgBox(Prompt:="The start time can NOT be
changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intStartResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Else
End If
Else
If IsEmpty("txtStartTime") = False Then
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End If
End Sub

But it disables the "Start" command button and does not record
the time even
though "txtStartTime" is blank. {That may be my problem - i'm
thinking of
excel - if(isblank(. . . . }. Would a while or with work better?
If so,
would you please sketch it out for me.

Thank you again,

A

:

Based on your post, it appears your form is in datasheet view.
You can
expect this to happen in Datasheet view. Change your form to
continuous view
and I think the problem will go away.

:

Pardon the following "slop", but I'm new at this. I have a
database
whose main table has 8 of 11 fields filled in by a report. I
am
attempting to update the remaining 3 fields (start time,
finish time,
and balanced) based on the input from a form. For the start
and finish
times, I have created command buttons for the following
purposes. For
the start time command button, I only want it "clickable" if
the start
time field is empty. Once clicked, I would like a message
box to
prompt the user to verify they are ready to start, then, if
they click
"OK" to record that time in the start time field, disable the
start
command button, and update the form. I have made the
following attempt
at a private sub:

Private Sub Start_Click()
Dim intResponse As Integer
intResponse = MsgBox(Prompt:="The start time can NOT be
changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation +
vbDefaultButton2,
Title:="WARNING")
If intResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End Sub


It works, but it disables all of the start times in the form
instead of
just the one clicked. (The form contains any number of
records). I'm
attempting to handle the refresh from a private OnUpdate sub
in the
Start Time field.


I haven't attempted the Finsh command button yet, but would
like a
message of "Is the tracer in balance?" to update the check
box and, if
the answer is yes, to update the form without that record
showing.


Any and all comments and suggestions are greatly appreciated.
If more
information is needed, please just let me know.


Thank you,


A
 
G

Guest

Thank you very much for all the help/pointers/assistance, etc. . .

Klatuu said:
I hope they do. It is the book I turn to first.

Douglas J. Steele said:
For more details about these books, take a look at
http://www.developershandbook.com

I know that they didn't produce an Access 2003 because it was felt that the
differences between Access 2002 and Access 2003 weren't sufficient enough to
warrant a new book.

The differences between Access 2003 and Access 2007, however, are
monumental. While I haven't heard whether they're planning a new book, I'd
have to think there's a need for one.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Klatuu said:
My favorite is "Access 2002 Desktop Developer's Handbook" by Paul Litwin,
Ken
Getz, and Mike Gunderloy, published by Sybex (www.sybex.com). There is a
companion book, "Access 2002 Enterprise Developer's Handbook". The sad
part
is, it will be the last. There is no plan to update for 2003, I don't
know
about 2007.

It is aimed at the Intermediate/Advanced user, but is a very valuable how
to
and why resource.

I don't know if it is still available from the publisher. I got mine from
a
used book store.

:

Klatuu,

Pardon the delay. I fixed the issue by looking in the Form Properties
and
setting Allow Edits = Yes and Data Entry = Yes; so forgive me for wasting
time/energy with that random question. Once again, thank you for the
help
and the clarity of your explanation. If you can, do you have a
book/reference that you would recommend for Access?

:

I really can't tell without some information about the control. Is it
bound
to a field in the recordset? Is the recordset a query or a table? if
it is a
query, is the query based on multiple tables and or queries? Are there
any
other controls on your form you can't enter anything into?

:

Klatuu and missinglinq,

Thank you very much for taking the time to explain my "logic" errors.
I
used the code provided by Klatuu and it works very well. I have,
however,
one follow up, if either of you have time. I can't enter anything in
the ID
field in the form and am not sure why. I have Locked = No and
Enabled = Yes,
but still can't enter numbers or letters.

Thank you again for all the help.

:

There are two function you are using that are really only meant for
Variant
variables. The IsMissing function is used to determine whether an
optional
argument in a function or sub has been received. Also, you are not
testing
the value of txtStartTime, you are testing a literal string.
If IsMissing("txtStartTime") = True Then

To determine whether a control has had anything entered, the ususal
method is:
If IsNull(Me.txtStartTime) = True Then

The IsEmpty function is really only useful for variants.
If IsEmpty("txtStartTime") = False Then
This should be
If IsNull(Me.txtStartTime) = False Then

Rather than enabling and disabling the controls, If you set them
both to
Enabled = No and Locked = Yes, Then they cannot accept the focus,
but you can
change them with the code in the command buttons.

I would set the Enabled property of the Finish button to No in
design view
and only enable it after a start time has been entered. You can
use the Form
Current event to Disable it for the next record.

Here is the code the way (IMHO) it should be:


Private Sub Start_Click()

If IsNull(Me.[Start_Time]) Then
If MsgBox("The start time can NOT be changed. Only Click
OK if you
" & _
are ready to balance!", vbOKCancel + vbExclamation
+ _
vbDefaultButton2, "WARNING") = vbOk Then
Me.[Start_Time] = Time()
ME.Finish.Enabled = True
Me.Finish.SetFocus
Me.Start.Enabled = False
End If
Else
MsgBox("The start time can NOT be changed.", vbExclamation,
"WARNING")
End If

End Sub


Private Sub Finish_Click()
Dim sngTimeDiff As Single

If IsNull(Me.Finish_Time) Then
Me.[Finish_Time] = Time()
lngTimeDiff = Datediff("s", Me.Start_Time, Me.Finish_Time)
Me.TotalTime = Format(lngTimeDiff \ 60, "00:") & _
Format(lngTimeDiff Mod 60,"00")
Else
MsgBox("The Finish time can NOT be changed.", _
vbExclamation, "WARNING")
End If

End Sub

Private Sub Form_Current()

Me.Start.Enabled = True
Me.Finish.Enabled = False

End Sub
:

Klatuu,

Thank you very much for the quick response. I checked the form
and I had it
set to "continuous form view". I've tried the following
"amendment":

Private Sub Start_Click()
Dim intStartResponse As Integer
If IsMissing("txtStartTime") = True Then
intStartResponse = MsgBox(Prompt:="The start time can NOT be
changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intStartResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Else
End If
Else
If IsEmpty("txtStartTime") = False Then
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End If
End Sub

But it disables the "Start" command button and does not record
the time even
though "txtStartTime" is blank. {That may be my problem - i'm
thinking of
excel - if(isblank(. . . . }. Would a while or with work better?
If so,
would you please sketch it out for me.

Thank you again,

A

:

Based on your post, it appears your form is in datasheet view.
You can
expect this to happen in Datasheet view. Change your form to
continuous view
and I think the problem will go away.

:

Pardon the following "slop", but I'm new at this. I have a
database
whose main table has 8 of 11 fields filled in by a report. I
am
attempting to update the remaining 3 fields (start time,
finish time,
and balanced) based on the input from a form. For the start
and finish
times, I have created command buttons for the following
purposes. For
the start time command button, I only want it "clickable" if
the start
time field is empty. Once clicked, I would like a message
box to
prompt the user to verify they are ready to start, then, if
they click
"OK" to record that time in the start time field, disable the
start
command button, and update the form. I have made the
following attempt
at a private sub:

Private Sub Start_Click()
Dim intResponse As Integer
intResponse = MsgBox(Prompt:="The start time can NOT be
changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation +
vbDefaultButton2,
Title:="WARNING")
If intResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End Sub


It works, but it disables all of the start times in the form
instead of
just the one clicked. (The form contains any number of
records). I'm
attempting to handle the refresh from a private OnUpdate sub
in the
Start Time field.


I haven't attempted the Finsh command button yet, but would
like a
message of "Is the tracer in balance?" to update the check
box and, if
the answer is yes, to update the form without that record
showing.


Any and all comments and suggestions are greatly appreciated.
If more
information is needed, please just let me know.


Thank you,


A
 
G

Guest

My pleasure.

asaylor said:
Thank you very much for all the help/pointers/assistance, etc. . .

Klatuu said:
I hope they do. It is the book I turn to first.

Douglas J. Steele said:
For more details about these books, take a look at
http://www.developershandbook.com

I know that they didn't produce an Access 2003 because it was felt that the
differences between Access 2002 and Access 2003 weren't sufficient enough to
warrant a new book.

The differences between Access 2003 and Access 2007, however, are
monumental. While I haven't heard whether they're planning a new book, I'd
have to think there's a need for one.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


My favorite is "Access 2002 Desktop Developer's Handbook" by Paul Litwin,
Ken
Getz, and Mike Gunderloy, published by Sybex (www.sybex.com). There is a
companion book, "Access 2002 Enterprise Developer's Handbook". The sad
part
is, it will be the last. There is no plan to update for 2003, I don't
know
about 2007.

It is aimed at the Intermediate/Advanced user, but is a very valuable how
to
and why resource.

I don't know if it is still available from the publisher. I got mine from
a
used book store.

:

Klatuu,

Pardon the delay. I fixed the issue by looking in the Form Properties
and
setting Allow Edits = Yes and Data Entry = Yes; so forgive me for wasting
time/energy with that random question. Once again, thank you for the
help
and the clarity of your explanation. If you can, do you have a
book/reference that you would recommend for Access?

:

I really can't tell without some information about the control. Is it
bound
to a field in the recordset? Is the recordset a query or a table? if
it is a
query, is the query based on multiple tables and or queries? Are there
any
other controls on your form you can't enter anything into?

:

Klatuu and missinglinq,

Thank you very much for taking the time to explain my "logic" errors.
I
used the code provided by Klatuu and it works very well. I have,
however,
one follow up, if either of you have time. I can't enter anything in
the ID
field in the form and am not sure why. I have Locked = No and
Enabled = Yes,
but still can't enter numbers or letters.

Thank you again for all the help.

:

There are two function you are using that are really only meant for
Variant
variables. The IsMissing function is used to determine whether an
optional
argument in a function or sub has been received. Also, you are not
testing
the value of txtStartTime, you are testing a literal string.
If IsMissing("txtStartTime") = True Then

To determine whether a control has had anything entered, the ususal
method is:
If IsNull(Me.txtStartTime) = True Then

The IsEmpty function is really only useful for variants.
If IsEmpty("txtStartTime") = False Then
This should be
If IsNull(Me.txtStartTime) = False Then

Rather than enabling and disabling the controls, If you set them
both to
Enabled = No and Locked = Yes, Then they cannot accept the focus,
but you can
change them with the code in the command buttons.

I would set the Enabled property of the Finish button to No in
design view
and only enable it after a start time has been entered. You can
use the Form
Current event to Disable it for the next record.

Here is the code the way (IMHO) it should be:


Private Sub Start_Click()

If IsNull(Me.[Start_Time]) Then
If MsgBox("The start time can NOT be changed. Only Click
OK if you
" & _
are ready to balance!", vbOKCancel + vbExclamation
+ _
vbDefaultButton2, "WARNING") = vbOk Then
Me.[Start_Time] = Time()
ME.Finish.Enabled = True
Me.Finish.SetFocus
Me.Start.Enabled = False
End If
Else
MsgBox("The start time can NOT be changed.", vbExclamation,
"WARNING")
End If

End Sub


Private Sub Finish_Click()
Dim sngTimeDiff As Single

If IsNull(Me.Finish_Time) Then
Me.[Finish_Time] = Time()
lngTimeDiff = Datediff("s", Me.Start_Time, Me.Finish_Time)
Me.TotalTime = Format(lngTimeDiff \ 60, "00:") & _
Format(lngTimeDiff Mod 60,"00")
Else
MsgBox("The Finish time can NOT be changed.", _
vbExclamation, "WARNING")
End If

End Sub

Private Sub Form_Current()

Me.Start.Enabled = True
Me.Finish.Enabled = False

End Sub
:

Klatuu,

Thank you very much for the quick response. I checked the form
and I had it
set to "continuous form view". I've tried the following
"amendment":

Private Sub Start_Click()
Dim intStartResponse As Integer
If IsMissing("txtStartTime") = True Then
intStartResponse = MsgBox(Prompt:="The start time can NOT be
changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation + vbDefaultButton2,
Title:="WARNING")
If intStartResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Else
End If
Else
If IsEmpty("txtStartTime") = False Then
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End If
End Sub

But it disables the "Start" command button and does not record
the time even
though "txtStartTime" is blank. {That may be my problem - i'm
thinking of
excel - if(isblank(. . . . }. Would a while or with work better?
If so,
would you please sketch it out for me.

Thank you again,

A

:

Based on your post, it appears your form is in datasheet view.
You can
expect this to happen in Datasheet view. Change your form to
continuous view
and I think the problem will go away.

:

Pardon the following "slop", but I'm new at this. I have a
database
whose main table has 8 of 11 fields filled in by a report. I
am
attempting to update the remaining 3 fields (start time,
finish time,
and balanced) based on the input from a form. For the start
and finish
times, I have created command buttons for the following
purposes. For
the start time command button, I only want it "clickable" if
the start
time field is empty. Once clicked, I would like a message
box to
prompt the user to verify they are ready to start, then, if
they click
"OK" to record that time in the start time field, disable the
start
command button, and update the form. I have made the
following attempt
at a private sub:

Private Sub Start_Click()
Dim intResponse As Integer
intResponse = MsgBox(Prompt:="The start time can NOT be
changed. Only
click OK if you are ready to balance!" _
, Buttons:=vbOKCancel + vbExclamation +
vbDefaultButton2,
Title:="WARNING")
If intResponse = vbOK Then
Me![Start_Time] = Time()
Me.Finish.SetFocus
Me.Start.Enabled = False
Else
End If
End Sub


It works, but it disables all of the start times in the form
instead of
just the one clicked. (The form contains any number of
records). I'm
attempting to handle the refresh from a private OnUpdate sub
in the
Start Time field.


I haven't attempted the Finsh command button yet, but would
like a
message of "Is the tracer in balance?" to update the check
box and, if
the answer is yes, to update the form without that record
showing.


Any and all comments and suggestions are greatly appreciated.
If more
information is needed, please just let me know.


Thank you,


A
 

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