Solved Calling Public Module

Weekleyba

Registered User.
Local time
Today, 07:44
Joined
Oct 10, 2013
Messages
593
How would you set this module up to check for the parent form creation of the ProjectID, (which is the primary key of the parent form)?
I have eight subforms where I want to use this.
Maybe I just need to place the code in all eight, since the Me.Undo is going to change also?
Thoughts?

1678195751669.png



It highlights the "Me" in If Me.Parent.ProjectID & "" = "" Then

1678195829413.png
 
Unless the code is in the forms module you can't use Me.

You could pass the calling form in as a parameter and then refer to it explicitly in the code.
Alternatively, disable the sub form until the project ID is filled out.
 
Code:
Public Function CheckParentProjectID( frm as access.form)
   ....
  frm.undo
  frm.parent.[Project Name].setFocus
end function

call CheckParentProjectID (ME)
 
Code:
Public Function CheckParentProjectID( frm as access.form)
   ....
  frm.undo
  frm.parent.[Project Name].setFocus
end function

call CheckParentProjectID (ME)
Maj P,
I'm getting this error.
Not sure what I'm doing wrong here.

1678216600816.png
 
Thanks to all!
Here's my solution that I can not put in every subform to check if the parent form has a ProjectID already created.

1678221319485.png
 

Users who are viewing this thread

Back
Top Bottom