A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Add and Edit



 
 
Thread Tools Display Modes
  #1  
Old August 19th, 2004, 05:46 AM
KRISH
external usenet poster
 
Posts: n/a
Default Add and Edit

Hi everybody,

I am placing edit button so that unless user presses it he
cannot be able to edit records in the form. my problem is
if he presses it my form all records in are open for
editing. how to change edit modes when user changes to new
record. My form contains subform also. so the edit mode
should be same for both main and subform with the same
button on main form. kindly help. thanks for any help.

krish
  #2  
Old August 19th, 2004, 06:04 AM
Dirk Goldgar
external usenet poster
 
Posts: n/a
Default

"KRISH" wrote in message

Hi everybody,

I am placing edit button so that unless user presses it he
cannot be able to edit records in the form. my problem is
if he presses it my form all records in are open for
editing. how to change edit modes when user changes to new
record. My form contains subform also. so the edit mode
should be same for both main and subform with the same
button on main form. kindly help. thanks for any help.

krish


You're going to need code both for your command button and for the
form's Current event. In its simplest form, it might look like this:

Private Sub Form_Current()
Me.AllowEdits = False
Me!sfMySubformControl.Form.AllowEdits = False
End Sub

Private Sub cmdEdit_Click()
Me.AllowEdits = True
Me!sfMySubformControl.Form.AllowEdits = True
End Sub

(where "sfMySubformControl" is the name of the subform control on the
main form, which may or may not be the same as the name of the fom
object the subform control displayes)

Do you want to allow the user to add new records on this form without
having to click the button? Do you want the user to be able to delete
records without having to click the button? If you want to control
those operations with the button also, you'll need add additional lines
to the event procedures to set the AllowAdditions and AllowDeletions
properties.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:33 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.