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!

Form Add or Edit Mode

Status
Not open for further replies.

dixxy

Technical User
Mar 4, 2003
220
CA
Hello,

i would like to know if there is a way to know how a form is being opend from a button on the switch board.

I have a Access swithcboard which is done with the 'SwitchBoard Manager', I would like to know if I make two buttons on that switchboard, one to open the frmjobs in 'Add' mode, and one to open the frmJobs in 'Edit' mode, is there a way to know which state that form is opened in, so to take different actions based on that.

So if the form is in add mode, then allow a job number to be created, if in edit mode than do not allow a job number to be created...

Is there a way to acheive this?

Thanks,

Sylvain
 
I tend not to use the data modes and just set the alloweditions, etc properties line by line in code. Check the data tab of the properties sheet for your form and you can see how to do that. You can just do
forms!frmWhatever.AllowAdditions = false

to disallow new records.

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Jeremy,

The problem is that in some case I want to allow thew additions, and in some not...and I want to take different actions based on the way the form was opened...

Thanks,

Sylvain
 
Dixxy:

I did it the following way:
I have users who can only read and users who can edit and add. Then I have supervisors who can edit special fields, if the editor is in their group.
Those with write permission can only write their own records but can see all records.
I decide between reader and writer with Form.AllowEdits etc.
Then I have a module connected to the Form_Current, which compares current user with record owner and locks or disables certain, or all controls.
If you need more let me know. It is a lot of overhead and I am not 100% sure if it was worthwhile.

Hopes that helps, georgp
 
georgp,

It sounds interesting, you are going a step further that what i have right now, I guess you have users set up (in a table i presume, with special rights for each, etc..)....

basically all i want is to open the same form in two different states, once in write, once in edit....at this point it is not really important who opens it.

I have tired to make a module and run that from the switchboard manager but it doesn't seem to want to work..

this is what i have:
Code:
Public Function OpenJobs(formname As String) As Boolean
DoCmd.OpenForm "frmJobs", , , , acFormAdd
MsgBox "add"
End Function

maybe i should look at your way, maybe i'm going down the wrong alley???



Thanks,

Sylvain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top