Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass subform value to main form

Status
Not open for further replies.

ainkca

Programmer
Aug 26, 2002
111
CA
Hi all,

I'm using Access97. I have a form based on a table and a subform based on a query, linked on an account number.

Main form: "frmAdmissionForm", Field: "AdmittedFrom"
Subform: "frmsubAdmittedFrom", Field: "AdmittedFrom"

What I'm trying to do is have the field "AdmittedFrom" on the subform, populate the "AdmittedFrom" field on the main form when a user clicks the "Accept" button I have created.

The AdmittedFrom field on the subform comes from a query that decides which record is the correct one to use per patient. The query is based on a table where there are many records for the same account.

The Main form is based on a table that has only a single record per account.

When I try (On click even of Accept button)
Me!AdmittedFrom = Forms!frmsubAdmittedFrom!AdmittedFrom

I get a runtime error 2113, that the data type isn't correct. They're both text. What am I doing wrong?

Thanks,
ainkca
 
Never mind, I got it. What worked was:

Me!AdmittedFrom = Me!frmsubAdmittedFrom!AdmittedFrom

It wanted Me instead of Forms.

Thanks anyway!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top