By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,658 Members | 1,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,658 IT Pros & Developers. It's quick & easy.

clear/reset the bounded fields in a form

P: n/a
I have a bounded form and after I click the button to update/save. THe
fields are still there. Is there a way to clear off the fields in the
bounded form.

Thanks,
SA

Here's the code that I have:

Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click

Dim Response
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
Response = MsgBox("The component has been successfully
updated !!", vbOKOnly, "Component Updated")

Exit_cmdSave_Click:
Exit Sub

Err_cmdSave_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Click

End Sub
Jun 27 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
ka*********@gmail.com wrote:
I have a bounded form and after I click the button to update/save. THe
fields are still there. Is there a way to clear off the fields in the
bounded form.

Thanks,
SA

Here's the code that I have:

Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click

Dim Response
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
Response = MsgBox("The component has been successfully
updated !!", vbOKOnly, "Component Updated")

Exit_cmdSave_Click:
Exit Sub

Err_cmdSave_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Click

End Sub
I don't get it. When you save a record, do you want it to clear the
values of that record? Then you save it and overwrite it?

Bound means associated to a table's records via the control's data source.

You could move to another new record. Maybe want you want to do is open
the form in DataEntry mode (under DataTab in Form's property sheet)

Also see the GoToRecord method/action in help.

Shoulder Holster
http://www.youtube.com/watch?v=2CgBr5hYumE
Jun 27 '08 #2

P: n/a
On May 20, 10:19*am, Salad <o...@vinegar.comwrote:
karsagar...@gmail.com wrote:
I have a bounded form and after I click the button to update/save. THe
fields are still there. Is there a way to clear off the fields in the
bounded form.
Thanks,
SA
Here's the code that I have:
Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click
* * Dim Response
* * DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
* * Response = MsgBox("The component has been successfully
updated !!", vbOKOnly, "Component Updated")
Exit_cmdSave_Click:
* * Exit Sub
Err_cmdSave_Click:
* * MsgBox Err.Description
* * Resume Exit_cmdSave_Click
End Sub

I don't get it. *When you save a record, do you want it to clear the
values of that record? *Then you save it and overwrite it?

Bound means associated to a table's records via the control's data source.

You could move to another new record. *Maybe want you want to do is open
the form in DataEntry mode (under DataTab in Form's property sheet)

Also see the GoToRecord method/action in help.

Shoulder Holsterhttp://www.youtube.com/watch?v=2CgBr5hYumE- Hide quoted text -

- Show quoted text -
Actually this is a cosmetic plus avoiding errors. I do not wish to
over write. What I want is to clear the fields in the form (but the
problem is that it is bounded ). So is it possible to make the fields
in a from appear empty/clear/reset after the save operation. Which
works perfectly well.
Jun 27 '08 #3

P: n/a
ka*********@gmail.com wrote:
On May 20, 10:19 am, Salad <o...@vinegar.comwrote:
>>karsagar...@gmail.com wrote:
>>>I have a bounded form and after I click the button to update/save. THe
fields are still there. Is there a way to clear off the fields in the
bounded form.
>>>Thanks,
SA
>>>Here's the code that I have:
>>>Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click
>> Dim Response
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
Response = MsgBox("The component has been successfully
updated !!", vbOKOnly, "Component Updated")
>>>Exit_cmdSave_Click:
Exit Sub
>>>Err_cmdSave_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Click
>>>End Sub

I don't get it. When you save a record, do you want it to clear the
values of that record? Then you save it and overwrite it?

Bound means associated to a table's records via the control's data source.

You could move to another new record. Maybe want you want to do is open
the form in DataEntry mode (under DataTab in Form's property sheet)

Also see the GoToRecord method/action in help.

Shoulder Holsterhttp://www.youtube.com/watch?v=2CgBr5hYumE- Hide quoted text -

- Show quoted text -


Actually this is a cosmetic plus avoiding errors. I do not wish to
over write. What I want is to clear the fields in the form (but the
problem is that it is bounded ). So is it possible to make the fields
in a from appear empty/clear/reset after the save operation. Which
works perfectly well.
I'd simply close the form.

You give absolutely no reason for clearing the fields. You've given no
indication in your response that you are moving to another record.

Maybe what you could do, instead of clearing the fields, is to enable or
disable controls based on the "state" of the record. Or lock the fields
depending on the state so the data isn't modified. (Locked and Enabled
are under the data tab).

Enable Locked Edit?
Y N Y
Y Y N
N N N
N Y N

Gene & Eddie
http://www.youtube.com/watch?v=afkfos_oQro
Jun 27 '08 #4

P: n/a
On May 20, 11:12*am, Salad <o...@vinegar.comwrote:
karsagar...@gmail.com wrote:
On May 20, 10:19 am, Salad <o...@vinegar.comwrote:
>karsagar...@gmail.com wrote:
>>I have a bounded form and after I click the button to update/save. THe
fields are still there. Is there a way to clear off the fields in the
bounded form.
>>Thanks,
SA
>>Here's the code that I have:
>>Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click
>* *Dim Response
* *DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
* *Response = MsgBox("The component has been successfully
updated !!", vbOKOnly, "Component Updated")
>>Exit_cmdSave_Click:
* *Exit Sub
>>Err_cmdSave_Click:
* *MsgBox Err.Description
* *Resume Exit_cmdSave_Click
>>End Sub
>I don't get it. *When you save a record, do you want it to clear the
values of that record? *Then you save it and overwrite it?
>Bound means associated to a table's records via the control's data source.
>You could move to another new record. *Maybe want you want to do is open
the form in DataEntry mode (under DataTab in Form's property sheet)
>Also see the GoToRecord method/action in help.
>Shoulder Holsterhttp://www.youtube.com/watch?v=2CgBr5hYumE-Hide quotedtext -
>- Show quoted text -
Actually this is a cosmetic plus avoiding errors. I do not wish to
over write. What I want is to clear the fields in the form (but the
problem is that it is bounded ). So is it possible to make the fields
in a from appear empty/clear/reset after the save operation. Which
works perfectly well.

I'd simply close the form.

You give absolutely no reason for clearing the fields. *You've given no
indication in your response that you are moving to another record.

Maybe what you could do, instead of clearing the fields, is to enable or
disable controls based on the "state" of the record. *Or lock the fields
depending on the state so the data isn't modified. *(Locked and Enabled
are under the data tab).

Enable *Locked *Edit?
* *Y * * * N * * * Y
* *Y * * * Y * * * N
* *N * * * N * * * N
* *N * * * Y * * * N

Gene & Eddiehttp://www.youtube.com/watch?v=afkfos_oQro- Hide quoted text-

- Show quoted text -
Thanks a lot. I think this would work for me. I could lock or disable
the control. My reasononing for wanting to do this was because when
the user modifies the field(s) in the form and then clicks the Update
button. The controls still have the data and it is hard to say if
anything even happened. Also there is a chance of data being modified
unintentionally by the user by exiting from the form or moving around
with the record navigation bar

Thanks.
Jun 27 '08 #5

P: n/a
ka*********@gmail.com wrote:
On May 20, 11:12 am, Salad <o...@vinegar.comwrote:
>>karsagar...@gmail.com wrote:
>>>On May 20, 10:19 am, Salad <o...@vinegar.comwrote:
>>>>karsagar...@gmail.com wrote:
>>>>>I have a bounded form and after I click the button to update/save. THe
>fields are still there. Is there a way to clear off the fields in the
>bounded form.
>>>>>Thanks,
>SA
>>>>>Here's the code that I have:
>>>>>Private Sub cmdSave_Click()
>On Error GoTo Err_cmdSave_Click
>>>> Dim Response
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
>acMenuVer70
Response = MsgBox("The component has been successfully
>updated !!", vbOKOnly, "Component Updated")
>>>>>Exit_cmdSave_Click:
Exit Sub
>>>>>Err_cmdSave_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Click
>>>>>End Sub
>>>>I don't get it. When you save a record, do you want it to clear the
values of that record? Then you save it and overwrite it?
>>>>Bound means associated to a table's records via the control's data source.
>>>>You could move to another new record. Maybe want you want to do is open
the form in DataEntry mode (under DataTab in Form's property sheet)
>>>>Also see the GoToRecord method/action in help.
>>>>Shoulder Holsterhttp://www.youtube.com/watch?v=2CgBr5hYumE-Hide quoted text -
>>>>- Show quoted text -
>>>Actually this is a cosmetic plus avoiding errors. I do not wish to
over write. What I want is to clear the fields in the form (but the
problem is that it is bounded ). So is it possible to make the fields
in a from appear empty/clear/reset after the save operation. Which
works perfectly well.

I'd simply close the form.

You give absolutely no reason for clearing the fields. You've given no
indication in your response that you are moving to another record.

Maybe what you could do, instead of clearing the fields, is to enable or
disable controls based on the "state" of the record. Or lock the fields
depending on the state so the data isn't modified. (Locked and Enabled
are under the data tab).

Enable Locked Edit?
Y N Y
Y Y N
N N N
N Y N

Gene & Eddiehttp://www.youtube.com/watch?v=afkfos_oQro- Hide quoted text -

- Show quoted text -


Thanks a lot. I think this would work for me. I could lock or disable
the control. My reasononing for wanting to do this was because when
the user modifies the field(s) in the form and then clicks the Update
button. The controls still have the data and it is hard to say if
anything even happened. Also there is a chance of data being modified
unintentionally by the user by exiting from the form or moving around
with the record navigation bar

Thanks.
Here's a routine that might help. Under the Other tab there's a row
called Tag. I put in the word EnDis for those records I want to
enable/disable. Then I call the subroutine like
EnableDisable False 'disable
EnableDisable True 'enable
So in your Save button code you'd use EnableDisable False. And in the
Add or Edit button EnableDisable True.
Sub EnableDisable(blnEnDis As Boolean)
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "Endis" Then ctl.Enabled = blnEnDis
Next
End Sub

Going On
http://www.youtube.com/watch?v=u_R9fId_Rqo
Jun 27 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.