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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Form With Command Button

Status
Not open for further replies.

Kevsim

Instructor
Apr 18, 2000
385
AU
I have a database where one form is for input (data placed in) and another for output (data for viewing, cannot input data).
To go from the output viewing form to the input form, there is a command button on the output form, which is supposed to open the input form at a blank record via a password.

When the input form opens all records are locked, you can go between records but can not modify any data.

From the VBA for the command button to open the form, what code would I require to open the form without the records locked?

When I open the input form by clicking the form file name, the form opens without the records being locked at a blank record.

I would appreciate your advise.
kevsim

 
Kevsim

>one form is for input
Data Entry --> Yes

>and another for output
Allow Edits --> No
Allow Deletions --> No
Allow Additions --> No
Data Entry --> No

No VBA required and this post should have been in forum702
 
If I understand correctly, it sounds like there is code on the command button to lock the form because when you open in from the object browser it is not locked.

Look at the code on the command button because there are several possibilities for locking the form. The command button should have some code with a "docmd.openform".

docmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs

the fifth argument "DataMode" could be "acReadOnly" which will lock the form for editing

If you just put
docmd.OpenForm "YourFormName"
then it will open in the edit mode.

However, there may be additional code that locks your form. If there is then post the code. For example in code you can change the properties that Jerry points out as well.
 
Kev,

This is my take,

Your recordset can be readonly. Perhaps you should populate your form from a readonly recordset. This way you can have 1 form. This will help you achieve the DRY principle (DONT REPEAT YOURSELF)

You should be using a singular form. Should you choose to bind the form to the data, this should be from a recordset that is readonly or a recordset that is writable, which is moved to a new record.

I suggest unbound forms with handling of whether the data is updatable or not to be handled by an extended method or property of the form.

Randall Vollen
 
I thank you all for the input.
Both forms had the edit/no edit etc, set correctly and I
appreciate everthing can be done with one form.
I solved the problem, I had to close the "Viewing" form before the code reached to open the "Input" form.
All is now working OK.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top