Solved Calling Public Module (1 Viewer)

Weekleyba

Registered User.
Local time
Today, 01:05
Joined
Oct 10, 2013
Messages
586
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
 

Minty

AWF VIP
Local time
Today, 07:05
Joined
Jul 26, 2013
Messages
10,371
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.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 02:05
Joined
May 21, 2018
Messages
8,547
Code:
Public Function CheckParentProjectID( frm as access.form)
   ....
  frm.undo
  frm.parent.[Project Name].setFocus
end function

call CheckParentProjectID (ME)
 

Weekleyba

Registered User.
Local time
Today, 01:05
Joined
Oct 10, 2013
Messages
586
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
 

Weekleyba

Registered User.
Local time
Today, 01:05
Joined
Oct 10, 2013
Messages
586
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

Top Bottom