Help on sub form (1 Viewer)

rshaw

New member
Local time
Today, 07:58
Joined
Feb 10, 2020
Messages
21
Greetings everyone,

I have a form that i have placed a command button to open a sub form for like personal notes that are not included on the original. I created a separate table to contain that information that i can create a report based on just that specific daily with those notes that will appear on that report. My problem is that I created the button linked to the sub form and when clicked the sub form comes up however it will not let me edit or add text to it. additionally it eliminates the information on the main form too.

should be a way to do this i would think. I had linked the tables together on the forms too. any help as always appreciated.
 

Attachments

  • Capture.PNG
    Capture.PNG
    6.1 KB · Views: 300
  • Capture2.PNG
    Capture2.PNG
    9.4 KB · Views: 299

Ranman256

Well-known member
Local time
Today, 09:58
Joined
Apr 9, 2015
Messages
4,339
your subform table must hav the foreign key:
MasterKey, long
SubFrmKey, auto

key both these fields,
then on the subform object, make sure you link the 2 properties:
LINK MASTER FIELDS: MasterKey
LINK CHILD FIELDS: MasterKey
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:58
Joined
Feb 19, 2002
Messages
43,233
It's not a subform unless it is embedded on a main form. Subforms have additional features because Access automagically keeps them in sync as long as you have set the master/child links. With a popup form, you don't have Access doing stuff for you so you need to do it yourself. When you open the popup form, you need to include a where clause so it opens to the correct record if that record exists. To handle the FK when the record does not yet exist, I pass it in the OpenArgs. Then, in the popup form's BeforeInsert event, I populate the FK with the passed information:

Me.Something = Me.OpenArgs

I can't tell from the pictures what "Something" is supposed to be. It looks like it should be ContractID but I'm not sure. Also, will you ALWAYS have only a single note? If not, you should make the popup a continuous form and you might want to log the inspector as well as the contract.

Normally when I have notes associated with something, I don't allow the notes to be modified except by the author and usually only within the first 24 hours or whatever makes sense. Sometimes, the business rules might allow a supervisor to modify notes made by someone else but it really depends on your application.
 

Users who are viewing this thread

Top Bottom