subform field requirement

B

bfence

Hi! I have a parent form that tracks student demographics. My
subform tracks the education program the student is in (there could be
more than one program/student). I want to ensure that the program
field on the subform cannot be left blank during data entry. I can't
seem to find the right solution! The catch is that the data entry
person, if leaving the program field blank, probably hasn't entered
any data into the subform. Any thoughts?

Thanks!
 
A

Al Campagna

bfence,
In your table design, set that field to "Required"
Whenever a new record is added to the subform, you can not exit that
record until the "required" field has been given a value.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
B

Betz

bfence,
    In your table design, set that field to "Required"
    Whenever a new record is added to the subform, you can not exit that
record until the "required" field has been given a value.
--
    hth
    Al Campagna
    Microsoft Access MVP
   http://home.comcast.net/~cccsolutions/index.html

    "Find a job that you love... and you'll never work a day in your life."


I have the field set as required in the table. I think the problem is
that the data entry person doesn't necessarily need to go into the
subform so the "required" isn't being triggered.

Thanks,
Betsy
 
J

John W. Vinson

Hi! I have a parent form that tracks student demographics. My
subform tracks the education program the student is in (there could be
more than one program/student). I want to ensure that the program
field on the subform cannot be left blank during data entry. I can't
seem to find the right solution! The catch is that the data entry
person, if leaving the program field blank, probably hasn't entered
any data into the subform. Any thoughts?

Thanks!

This can be tricky. You can't use the mainform's BeforeUpdate event, since it
fires the instant you setfocus to the subform. In fact your assertion that
"the field on the subform cannot be left blank during data entry" is ipso
facto impossible, since the subform must *start out* blank, even after a
record is created on the mainform.

I'd suggest using the mainform's Exit and Current events to run a query
searching for missing records in the child table.
 
A

a a r o n _ k e m p f

or, SQL Server has triggers-- this can help to enforce data quality.

jet doesn't have the basics of a mdoern RDBMS because it's been
obsolete for the past decade.
Jet hasn't gotten a single new feature for the past decade
 

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