Add new record form

christakis

Registered User.
Local time
Today, 19:03
Joined
Oct 23, 2009
Messages
72
Hi Guys,

I want to have 2 separate forms to add and edit records. How do I make sure there is no way a user can edit any records in the "add form"?!

Here's what I've done so far:
  • Removed Navigation Buttons
  • Set "On Open" event of form to do the same function as a "New Record" button

However, when i press the UP button in the first field, the form goes to the previous record. This also happens when I use the scroll button of the mouse.

Also is there a way to auto-open a combo box? This is very helpful for "keyboard only" people.

Finally, what can I do with the error in the attached picture?

Cheers,
Christakis
 

Attachments

  • untitled.JPG
    untitled.JPG
    13.4 KB · Views: 115
Last edited:
I would just have one form, and use the data mode argument of OpenForm to determine which mode it's in.

You can drop down a combo in its on focus event with:

Me.ComboName.Dropdown

What do you want to do with the error? It's stopping you from entering a record with a null value in that field. If you want to allow nulls, change the required property of the field in the table to no.
 
I would just have one form, and use the data mode argument of OpenForm to determine which mode it's in.

You can drop down a combo in its on focus event with:

Me.ComboName.Dropdown

What do you want to do with the error? It's stopping you from entering a record with a null value in that field. If you want to allow nulls, change the required property of the field in the table to no.

How do I use the data mode?

Regarding the error, I just want to show a more user friendly error.
 
If you look in VBA help at OpenForm, it should detail the various options, their impacts and how to use them.

Data errors like that can be trapped in the form's error event. You'd trap for that specific error number, provide your own message, and include this to avoid the system message:

Response = acDataErrContinue
 
If you look in VBA help at OpenForm, it should detail the various options, their impacts and how to use them.

Data errors like that can be trapped in the form's error event. You'd trap for that specific error number, provide your own message, and include this to avoid the system message:

Response = acDataErrContinue

Thank you for your response. I will check it out and get back to you. Any ideas on how to avoid the other records showing up ?
 
christakis,

First, let me say that Paul is certainly pointing you in the right direction and I in no way disagree with him.

However, if you really want to use your form "add only" form you can modify the Data Mode properties for your form. (thats the modes that Paul is talking about). With the "properties" dialog box for your "add only" form displayed, click on the "Data" tab and locate the "Allow Edits" property and change the value to "No" and change the "Allow Deletions" property to "No. This will prevent users editing or deleting records.

Now for the nex issue:
when i press the UP button in the first field, the form goes to the previous reco
Again in the properties dialog box, click on the "Other" tab and locate the "Cycle" property. Change this property to the "Current Record" option.

when i press the UP button in the first field, the form goes to the previous reco
For this one, here is a link that might point you in the right direction:
http://support.microsoft.com/kb/278379

Good luck with your project.
 
Actually, what I was talking about was using the bold argument to use one form for either data entry or edit:

DoCmd.OpenForm formname[, view][, filtername][, wherecondition][, datamode][, windowmode][, openargs]
 
Aha! Thank you both for the very helpful tips.

Currently, I have two types of forms. The first form is the search form, it has unbound combo-boxes which take their row source data from the assets table. it also has a subform which shows the results of a query. The query basically shows all data in the table and filters them based on the user selections above. The fields of the query are currently "locked" so that users cannot change them. I was thinking of using this type form to also edit the fields.

The second form is the Add form. All I did was use the wizard to auto generate a form with all fields of the table. I added a few buttons to "Add new record" and "Save Record". I have had a bitter taste of wrongly engineered forms where users accidentally edited existing records when trying to add new ones. Correct data are critical for this database. Sadly I don't have the expertise to guarantee I will be able to create a flawless combined add/edit form. Willing to give it a try though if you point me in the right direction (A tutorial link or even better an example would be very appreciated).

Best Regards,
Christakis
 

Users who are viewing this thread

Back
Top Bottom