Default value on a filtered form

D

DarrenNotts

Hi I have 2 forms open. The 1st has filtered records to show one of
several open records. I use a button to open a 2nd form to show
information about the filtered person in the 1st form.
what I need to do is add a new record in the 2nd form so that it is
attached to the person in the 1st form.
Both forms contain the record: [Pupil ID] so the 2nd form needs to
have the same [Pupil ID] as the 1st form by default. The way it works
now is that a record is created in the 2nd form but with no [Pupil ID]
Does anyone know how I can create the saved [Pupil ID] as in the 1st
form? Remember, That BOTH forms are open and FILTERED. I hope someone
can help as I am running out of ideas. Many Thanks.
 
S

strive4peace

Hi Darren,

use this for the DefaultValue of Pupil ID on the second form:

=forms!FirstFormname!PupilID_controlname

~~~

btw, it might be easier to make the second form a subform of the first
form and set PupilID to be the LinkMasterField and LinkChildFields of
the subform control

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
D

DarrenNotts

Hi Crystal,

Thank you for your reply, I did have the 2nd form as a subform to the
1st and it did work, however it made the form too big and I didn't
want to have any scroll bars on the form. I wanted to use a page
break, but didn't know how they work. Ideally I would like to be able
to use a button to go to the 2nd page rather than using scroll bars.

Your idea of using the default value as above deos not work, I don't
understand the part "_controlname". The control name is Pupil ID. I
have tried the following as the deafult but got a syntax error
message: = Forms![Pupils]![ID]_Pupil ID, The 1st form name is
"Pupils", the field I need to match in the 2nd form is [ID] and the
control name for the field is "Pupil ID".

If you can tell me how to do either of the above I would be very
gratefull.

Many thanks

Darren
 
S

strive4peace

Hi Darren,

"I don't understand the part "_controlname""

I just meant for you to substitute whatever you are calling things ...

try this in the default value of your ID control on the second form:

=Forms![Pupils]![Pupil ID]

WHERE
The name of your form is --> Pupils
The name of the control on that form you want to get the default value
from is --> Pupil ID

to see if this is right for YOUR forms, make the control show if it is
not visible so you can see what it gets when you make a new record

~~~
"the field I need to match in the 2nd form is [ID]"

in the table that the form is based on, what is the data type for ID?

what is the data type for [Pupil ID] in the table that the first form is
based on?

~~~
btw, it is not a good idea to use spaces in fieldnames...


Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top