Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Entering New Records

Status
Not open for further replies.

kjonnnnn

MIS
Aug 25, 2000
317
US
I'm using a form to enter data into access. In the form there is a MEMBER NAME field, which is a lookup. Whomever is entering data, clicks into the field and a drop down list of names appear.

My question is how to you prevent the person entering data from mistakingly overwrite a previous entry.

It would be ideal that if a record is already entered, you CANNOT edit that record without someother step. Im trying to prevent messing up records in instances where someone forget to select new record.

Heres an example of my form. It contains a member name field and various fields for financial contributions to this organization.

If a person selects a name and doesnt select NEW RECORD, the information on that person's previous contribution will be overwritten.
 
You could have your form go directly to a new form when you activate the form.

for the On Activate event sub type: DoCmd.GoToRecord , , acNewRec

This way you don't have to hope that the user remembers to press the Add New Record button before they start selecting names, etc when they open the form.

Also, try selecting "no" for rights to edit on the form properties. This will prevent users from editing previously saved data. You may have to enter record-saving code in an On Change event (in the last txt box the user enters data into) so MS Access will treat the record as saved data and not allow editing.

I hope this helps you.
 
With your form in design mode, dbl click on the little black box in the upper left hand corner of the form. This opens the forms properties. With the properties window open, click on the Event tab. Locate the 'On Activate' property. Click on the line to the right of it and click on the drop-down arrow and select [event procedure]. Now, click on the '...' button to the right of the line. Enter the DoCmd so your event sub should look like this:

Private Sub Form_Activate()
DoCmd.GoToRecord , , acNewRec
End Sub

Text boxes also have properties associated with them. Right click on the object (text box) and click on Properties. Click on the Event tab and locate On Change. (Access help has excellent descriptions of all the properties' events and when and how you can use them). Click on [event procedure] and on '...'. Type the following in the sub:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

BTW - you could always use macros instead of code if you want. Skip the [event procedure] part and click on the '...'. click on macro builder and go from there.

Hope this helps.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top