Have a text box on form B equal what’s in a form A text box (1 Viewer)

Mr. SLP

Registered User.
Local time
Today, 11:30
Joined
Dec 23, 2017
Messages
56
I have a button on form A that brings up form B for me to choose items to assign to the student represented in form A. Form B references a query to show only unassigned items. I have a checkbox and want to set it so that the foreign key in form B will be set to match the primary key of form A on check... I can’t seem to figure out how to reference the current status on a field on a different form to affect the value of a field on the current form.


Sent from my iPhone using Tapatalk
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:30
Joined
Feb 19, 2002
Messages
43,257
I think you may be doing this the hard way but -

Me.FK = Forms!formA!PK
 

Mr. SLP

Registered User.
Local time
Today, 11:30
Joined
Dec 23, 2017
Messages
56
I think I should’ve mentioned that form B is a data sheet. Not sure if that makes a difference.


Sent from my iPhone using Tapatalk
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:30
Joined
May 7, 2009
Messages
19,230
Where us the chkbox, form a or b?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:30
Joined
May 7, 2009
Messages
19,230
Use the chkbox after update event:

Privare sub assign_afterupdate()
If me.assugn then

Forms!FormA!StydentId=Me.Studentid
End if
End sub
 
Last edited:

Mr. SLP

Registered User.
Local time
Today, 11:30
Joined
Dec 23, 2017
Messages
56
Where us the chkbox, form a or b?



Checkbox is on B.

This is what I currently have but it’s not working
Private sub assign_click()
if me.assign=true then
Me.student=forms!ipads!studentID
ELSE
me.student= 11
End if
End sub

Form iPads= form A
Form B= add_apps


Sent from my iPhone using Tapatalk
 

mike60smart

Registered User.
Local time
Today, 17:30
Joined
Aug 6, 2017
Messages
1,904
Hi

The Normal method to add child records in a Form is to have a Standard Main Form and Subform layout so that the Foreign Key in the Subform is automatically added by Access.
 

Mr. SLP

Registered User.
Local time
Today, 11:30
Joined
Dec 23, 2017
Messages
56
Finally got it. Figured out. The problem was unrelated to this and I feel dumb. Thanks guys


Sent from my iPhone using Tapatalk
 

Users who are viewing this thread

Top Bottom