Forms Add, Edit or View

E

Eric

I have a Tab Form that holds 4 different forms. I need the user to be able
enter the Tab Form under different modes through a command button on the main
form. The command buttons will be Add, Edit or View.

I don't think I need to duplicate all the forms including the TabForm to
make this happen. The forms being used in the Tab Form are currently set at
DataEntry (Add). Should I leave that original setting on all forms and then
change the "Data Mode" setting for each differenct mode from the "open Form
Macro" command button on the main page...... or something else?

Thanks
 
K

Klatuu

Use the
Allow Edits
Allow Deletions
and Data Entry properties to control what the user can do.
 
E

Eric

Thanks Klatuu, I understand that. But I want all three available with the
same form. So where do I make those settings so that those options change
when the user chooses what they want to do.

If I set the form to "Data Entry".... how does that property change to
"Allow Edits" for another instance/use of the same form?

I want to use the same form for all Data Entry, Allow Edits, Allow Deletions.

Thanks again
 
K

Klatuu

You set the options whereever the user is changing the choices. How does a
user make the selection?
 
E

Eric

I will have command buttons on a main page "Add" "Edit" and "View".
Depending on what they choose, is how I need the form to open.

Thanks
 
K

Klatuu

Use the OpenForm OpenArgs argument to pass a value to the form and in the
form's Load event, set the properties based on what values the form received.
 
E

Eric

Thanks Klatuu, I'll try to struggle through this.... as you can see I'm a
rookie and what you just said really doesn't help. But I'm one to keep
trying...

Thanks anyway, but the code you're suggesting...... I don't know how to
write it.
 
K

Klatuu

Sorry, Eric. I didn't know.

First, I would not recommend what you are doing. It really isn't necessary.
I know a lot of people (me included) that early on wanted to impose that
kind of control. I found out, as most do after a while, it is not easy to
code, and difficult to avoid problems.

The native operation of Access forms really works pretty well. You can
always use the build in navigation buttons and train your users to click the
button with the * on it when they want to add a record and that the escape
key hit once clears the current control and hit twice clears all changes to
the current record.

Any time you move away from the current record or close the form, the
current record is saved.

So it isn't like it was in the old days where the programmer had to do it
all, but some do prefer to use their own controls. If you want to control
everything yourself, here are some basics.

You can have a button to add a new record and in the click event you would
have:

Docmd.GotRecord acDataForm, "NameOfForm", acNewRec

If the form is the current form where you put the name of the form, you can
use
Me.Name

If you want the a button that cancels any changes to a form, you use the
Undo method.
In the current form where it is typically done, it would be

Me.Undo

Now, if you want to have the form normally in view only mode, and you want
the user to be able to click a button to edit the current record, you can set
the Allow Editsto No in design mode. Then in the Click event of the button
it would be:

Me.AllowEdits = True

And to set it back to view only, you would use the form after udpdate event
Me.AllowEdits = False

Hopefully this will get you on your way. Please feel free to post back if
you nave more questions.
 
E

Eric

Now we're talking my kind of language. Thank you so much! And the great
advice you provided was worth more then the answer to my question.

I think I can get it now, I just have to re-visualize my path and use your
suggestions.

Thanks Klatuu, you are awesome!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top