Form & Subforms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

OK Here goes; I have two tables Box and File.
Box contains: Box number (Auto Number) and Pick-up date
File contains: Box number, File Number and Folder number
The tables have a one to many relationship for the Box number field with box
number being the connection.

In a form I have a subform for the Box table when you enter a pick-up date
it creates the box number. I have added unbound fields for the file table to
the form itself. What I want the form to do is when the user enters a file
and folder number to the fields it will add the box number from the subform
to the related field in the file table. I placed a second subform in the form
that is connected to a query that looks to the box number from the first
subform to show a list of all files in the current box.

Please Help!
 
I would create a from with Box Number and p/up date on it and a third item
(text box) called nav_item.

Then use the subform wizard to put the file table on a subform, and the
wizard will automatically put the related box number on the subform for you.

The nav_item is used the following way, in the lost focus event, send the
focus to the subform eg:

On_Lost_focus

me.filenumber.setfocus

This way when the user hits tab after they enter the pickup date, it goes
directly to the file number field of you subform. As soon as data is entered
in this field, access inserts the relevant box number into the box number
field on the subform (if you have linked the forms correctly with the
wizard). To go one step further, you can even make the box number field not
visible, or un-enabled so the user cannot change the value.

Good luck
Dylan.
 
Back
Top