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. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Can I use a comand button to change the form properties?
Hi
I would like to use a command button to change my forms properties. The forms AllowEdits, AllowAdditions, and AllowDeletetions is normally set to No. I would like to have a button to set them to Yes. Can this be done with the setvalue action in a macro. Thanks, Tom -- Message posted via http://www.accessmonster.com |
#2
|
|||
|
|||
On the Onclick event of the button, you can write the code
Me.AllowDeletions = True Me.AllowEdits = True Me.AllowAdditions = True -- I hope that helped Good luck "Tom K via AccessMonster.com" wrote: Hi I would like to use a command button to change my forms properties. The forms AllowEdits, AllowAdditions, and AllowDeletetions is normally set to No. I would like to have a button to set them to Yes. Can this be done with the setvalue action in a macro. Thanks, Tom -- Message posted via http://www.accessmonster.com |
#3
|
|||
|
|||
Thanks,
Can I do this with a macro? Tom Ofer wrote: On the Onclick event of the button, you can write the code Me.AllowDeletions = True Me.AllowEdits = True Me.AllowAdditions = True Hi I would like to use a command button to change my forms properties. The forms [quoted text clipped - 5 lines] Tom -- Message posted via http://www.accessmonster.com |
#4
|
|||
|
|||
Why would you want to go through the extra steps of doing it in a macro?
Just use the code. It's easier and cleaner. -- Rick B "Tom K via AccessMonster.com" u9562@uwe wrote in message news:54ff306a5ab99@uwe... Thanks, Can I do this with a macro? Tom Ofer wrote: On the Onclick event of the button, you can write the code Me.AllowDeletions = True Me.AllowEdits = True Me.AllowAdditions = True Hi I would like to use a command button to change my forms properties. The forms [quoted text clipped - 5 lines] Tom -- Message posted via http://www.accessmonster.com |
#5
|
|||
|
|||
What code could I use with this to allow me to enter a new record? Like the
macro action Add New Record. Tom -- Message posted via http://www.accessmonster.com |
#6
|
|||
|
|||
DoCmd.GoToRecord , , acNext
-- Rick B "Tom K via AccessMonster.com" u9562@uwe wrote in message news:54ffc533db30d@uwe... What code could I use with this to allow me to enter a new record? Like the macro action Add New Record. Tom -- Message posted via http://www.accessmonster.com |
#7
|
|||
|
|||
To add a new record using VBA will be
DoCmd.GoToRecord , , acNewRec -- I hope that helped Good luck "Tom K via AccessMonster.com" wrote: What code could I use with this to allow me to enter a new record? Like the macro action Add New Record. Tom -- Message posted via http://www.accessmonster.com |
#8
|
|||
|
|||
Very nice to have that! I have always wanted to find a way to do that.
How simple and efficient. I always end up making 2 identical forms - 1 with allow edits, 1 without...or I have to use 2 Switchboard commands - 1 to open a form in edit mode, 1 to open the form in add mode. One quick question...would there be an easy way to open a form and have all the fields grayed out initially (I guess it's really just changing the back color of the fields) and when they click on the "EDIT" button, it will "ungray" them - just to show a quick visual to the user whether they are in "Edit Mode" or not. I guess it would need to be some additional code associated with the same button. Thanks, Darrell Tom K via AccessMonster.com wrote: Thanks, Can I do this with a macro? Tom Ofer wrote: On the Onclick event of the button, you can write the code Me.AllowDeletions = True Me.AllowEdits = True Me.AllowAdditions = True Hi I would like to use a command button to change my forms properties. The forms [quoted text clipped - 5 lines] Tom |
#9
|
|||
|
|||
I would like to make it harder for users to edit records, but not impossible.
Using a New Record Form or a Edit Records Form works but it seems like there should be a better way. Using the AddRecord button that is on the form or leaving a form that can be edited just seems like it would be to easy to delete or screw up data by accident. What is the best way to handle forms and not make it to easy to screw up the data? Tom Darrell Childress wrote: Very nice to have that! I have always wanted to find a way to do that. How simple and efficient. I always end up making 2 identical forms - 1 with allow edits, 1 without...or I have to use 2 Switchboard commands - 1 to open a form in edit mode, 1 to open the form in add mode. One quick question...would there be an easy way to open a form and have all the fields grayed out initially (I guess it's really just changing the back color of the fields) and when they click on the "EDIT" button, it will "ungray" them - just to show a quick visual to the user whether they are in "Edit Mode" or not. I guess it would need to be some additional code associated with the same button. Thanks, Darrell Thanks, Can I do this with a macro? [quoted text clipped - 12 lines] Tom -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200509/1 |
#10
|
|||
|
|||
I have just done this myself for the first time and got it working.. hot off
the press! I think an "Add Record" button is safe because the users will se quite clearly new blank fields appearing on the form so will know they are about to input new records. You can create another button, "CANCEL," and have it appear on the screen after the Add Record button is pressed to make things even clearer and failsafe (we'll see....!!!) do this by including this in the Add Record button's onClick event: Me.YourButtonName.Visible = true To stop users from causing an error by potentially clicking the "Add New Record" button again whilst already in Add Mode, position the new button on top of the Add New button in design view, then set its visible property to no in properties window of design view. this new button might be labelled "Cancel Add New Record (without saving)." Set its onClick value to the following in VBA: Private Sub YourButtonName_Click() If Me.Dirty Then Me.Undo DoCmd.GoToRecord , , acPrevious Me.[YourField].SetFocus Me.YourButtonName.Visible = False When the user clicks this button, the "new" record will not be deleted and the form will go back to showing a previous record. If any changes have been made to the blank fields in the form, they will not be saved - so a new record will not be created. The Cancel button disappears to show the add new record button again. Note that this works in a single form - I'm not sure if it would work in a continuous form (although it might....) but the potential problem is that it might undo any changes to other records in the subform (not sure about this...) ** Does anyone know how to get the form to display the record it was showing before the "Add new record" button was pressed (ie before the form was opened in add mode....?) This VBA doesn't seem to work (instead it displays the first record in the table for some reason.....) Should this be working? Maybe I've got a form resfresh happening which is stopping this....?? Let me know if you do!** DoCmd.GoToRecord , , acPrevious "Tom K via AccessMonster.com" wrote: I would like to make it harder for users to edit records, but not impossible. Using a New Record Form or a Edit Records Form works but it seems like there should be a better way. Using the AddRecord button that is on the form or leaving a form that can be edited just seems like it would be to easy to delete or screw up data by accident. What is the best way to handle forms and not make it to easy to screw up the data? Tom Darrell Childress wrote: Very nice to have that! I have always wanted to find a way to do that. How simple and efficient. I always end up making 2 identical forms - 1 with allow edits, 1 without...or I have to use 2 Switchboard commands - 1 to open a form in edit mode, 1 to open the form in add mode. One quick question...would there be an easy way to open a form and have all the fields grayed out initially (I guess it's really just changing the back color of the fields) and when they click on the "EDIT" button, it will "ungray" them - just to show a quick visual to the user whether they are in "Edit Mode" or not. I guess it would need to be some additional code associated with the same button. Thanks, Darrell Thanks, Can I do this with a macro? [quoted text clipped - 12 lines] Tom -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200509/1 |
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Requerying a pop up form to display in the main form | Jennifer P | Using Forms | 13 | April 5th, 2005 06:59 PM |
Need to clear controls of Filter form | Jan Il | Using Forms | 2 | November 28th, 2004 02:04 PM |
Default values to load up automatically in a form based on value entered in another form | Anthony Dowd | Using Forms | 8 | August 12th, 2004 08:53 AM |
dlookup | miaplacidus | Using Forms | 9 | August 5th, 2004 09:16 PM |
synchronizing form and list box | Deb Smith | Using Forms | 8 | June 21st, 2004 08:15 PM |