Where is the user coming from!?

hhzyousafi

Registered User.
Local time
Today, 16:59
Joined
Nov 18, 2013
Messages
74
I have one form that is currently being used for two different purposes. The first purpose is basic data entry of a new record whilst the second purpose is to edit and update a specific record.

The end-user, for each specific purpose, arrives at the form from a specific route. For example I have a "Dashboard" where the end-user will click on "Add a New Employee" and that will open up the form in "data entry" mode. The other route is that the end-user will click a report that is based on a query where the end-user can double-click the employee's name and the same form would open up in "edit/update" mode.

Is there anyway to tell VBA that this particular end-user is coming from this particular route? I would really like to avoid creating a new form as there are almost 1000+ lines of code in this form and I would really like to avoid writing it again. What I have been able to do thus far is tell Access the most likely scenario. When an end-user is going to want to edit or update an employee then he/she will have to open up form "XYZ" and then come to the form to edit/update the record. I have been able to handle this scenario just fine; however what if the end-user has form "XYZ" open and he/she clicks on "Add a New Employee". Right now the code I have does not cater to this situation. The code I am using right now is as follows:

If CurrentProject.AllForms("frmBasicEmployeeInformationSearch").IsLoaded Then
Else
DoCmd.GoToRecord , , acNewRec
End If​

In this scenario form "XYZ" is form "frmBasicEmployeeInformationSearch".
 
You always can use the OpenArgs method. Under the DoCmd.OpenForm method there is an argument called OpenArgs, you can use that to identify which form opened the calling form.
 
Hi Paul,

Thank you for the quick response. That worked beautifully! :)

Regards,

Zohair Yousafi
 

Users who are viewing this thread

Back
Top Bottom