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  

Creating a Command Button



 
 
Thread Tools Display Modes
  #1  
Old April 7th, 2009, 06:22 PM posted to microsoft.public.access.forms
Yecenia
external usenet poster
 
Posts: 29
Default Creating a Command Button

Hello, I need to create a form that shows information in a read only
fashion. However, I need a command button that allows the form to be edit.

How would you create this command? i know access, but not VBA coding.
Please help.

Thanks!
  #2  
Old April 7th, 2009, 06:30 PM posted to microsoft.public.access.forms
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Creating a Command Button

Why not set Allow Edits to No and then the command button to change it to
Yes.

You will also need to have On Close set Allow Edits to No.

"Yecenia" wrote:

Hello, I need to create a form that shows information in a read only
fashion. However, I need a command button that allows the form to be edit.

How would you create this command? i know access, but not VBA coding.
Please help.

Thanks!

  #3  
Old April 7th, 2009, 08:35 PM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default Creating a Command Button

This will set the records to read-only, then allow editing of the current
record when the cmdEditRecord button is clicked. When you move to another
record, the read-only status will be re-instituted.

Private Sub Form_Current()
Me.AllowEdits = False
End Sub

Private Sub cmdEditRecord_Click()
Me.AllowEdits = True
End Sub

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

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200904/1

  #4  
Old April 7th, 2009, 08:37 PM posted to microsoft.public.access.forms
Yecenia
external usenet poster
 
Posts: 29
Default Creating a Command Button

Changing the setting to not Allow Edit is simple, but how would you create
the button that changes those settings to "yes"?

Would you create a Macro? I am not familiar with VBA coding.

"KARL DEWEY" wrote:

Why not set Allow Edits to No and then the command button to change it to
Yes.

You will also need to have On Close set Allow Edits to No.

"Yecenia" wrote:

Hello, I need to create a form that shows information in a read only
fashion. However, I need a command button that allows the form to be edit.

How would you create this command? i know access, but not VBA coding.
Please help.

Thanks!

  #5  
Old April 9th, 2009, 07:02 PM posted to microsoft.public.access.forms
Yecenia
external usenet poster
 
Posts: 29
Default Creating a Command Button

I used your suggested code under a command button, but I got an error.

Please excuse lack of VBA skills, but does this command require two command
buttons?

I've been working closely with access since 2006, but I've never needed to
tap into VB or SQL until now. i appreciate your patience.

"Linq Adams via AccessMonster.com" wrote:

This will set the records to read-only, then allow editing of the current
record when the cmdEditRecord button is clicked. When you move to another
record, the read-only status will be re-instituted.

Private Sub Form_Current()
Me.AllowEdits = False
End Sub

Private Sub cmdEditRecord_Click()
Me.AllowEdits = True
End Sub

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

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200904/1


  #6  
Old April 14th, 2009, 03:28 PM posted to microsoft.public.access.forms
Damon Heron[_3_]
external usenet poster
 
Posts: 257
Default Creating a Command Button

The code "Form_Current" is entered in the VB window for the form's current
event, the other code is for the command button click event...

"Yecenia" wrote in message
...
I used your suggested code under a command button, but I got an error.

Please excuse lack of VBA skills, but does this command require two
command
buttons?

I've been working closely with access since 2006, but I've never needed to
tap into VB or SQL until now. i appreciate your patience.

"Linq Adams via AccessMonster.com" wrote:

This will set the records to read-only, then allow editing of the current
record when the cmdEditRecord button is clicked. When you move to another
record, the read-only status will be re-instituted.

Private Sub Form_Current()
Me.AllowEdits = False
End Sub

Private Sub cmdEditRecord_Click()
Me.AllowEdits = True
End Sub

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

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200904/1




 




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 07:44 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.