Sub Forms

J

JWeaver

I have a Main Form that I use to enter payroll information for a full week to
track total hours worked but I want to add a Sub Form that will track details
for that week for hours worked each day of that week. I have attempted this
several times but am having difficulties getting it to work. I tried this
for one record and entered all information on the Main Form and Sub Form.
But when I went back to the record, the Sub Form details were no longer
there. However, I looked at the Sub Form table and the details are listed.

I linked the Forms together using an ID field from the Main Form to a Detail
ID in the Sub Form.

Any help would be greatly appreciated.

Thanks,
 
G

Golfinray

You need to have fields in the table that you want to store the subform data
in. Then let the subform wizard create the subform so that it will link
properly. If you are not storing, it is probably one of the two. Also make
sure the table you are storing those files in are editable (arrow and
asterisk at the bottom.) Then you could use a combo box to search with. Put a
combo on the main form (let the combo wizard create that for you.) Go to the
properties of the combo and right click. Go to events, afterupdate, and start
the code builder and type:
Me.filter = "[yourtablefieldyouwanttosearchon] = """ & Me.combo & """"
Me.filteron=true

combo will be combo8 or combo16 or whatever number it assigns.
 
J

JWeaver

Thanks, that works great for searching for records for a particular employee
but what I want to do is choose the employee # then have the last name, first
name, and pay rate fields completed automatically for new records so that I
don't have to type this information each time and also to ensure that the
information stays consistent. The employee information is in a separate
table called Employee Names.

Thanks in advance for any help you might be able to give me!
--
JWeaver


Golfinray said:
You need to have fields in the table that you want to store the subform data
in. Then let the subform wizard create the subform so that it will link
properly. If you are not storing, it is probably one of the two. Also make
sure the table you are storing those files in are editable (arrow and
asterisk at the bottom.) Then you could use a combo box to search with. Put a
combo on the main form (let the combo wizard create that for you.) Go to the
properties of the combo and right click. Go to events, afterupdate, and start
the code builder and type:
Me.filter = "[yourtablefieldyouwanttosearchon] = """ & Me.combo & """"
Me.filteron=true

combo will be combo8 or combo16 or whatever number it assigns.

JWeaver said:
I have a Main Form that I use to enter payroll information for a full week to
track total hours worked but I want to add a Sub Form that will track details
for that week for hours worked each day of that week. I have attempted this
several times but am having difficulties getting it to work. I tried this
for one record and entered all information on the Main Form and Sub Form.
But when I went back to the record, the Sub Form details were no longer
there. However, I looked at the Sub Form table and the details are listed.

I linked the Forms together using an ID field from the Main Form to a Detail
ID in the Sub Form.

Any help would be greatly appreciated.

Thanks,
 
J

Jason

You already have a table containing that information. All you need is enter
the ID # in the new table for the employee. Then have the relationship
between the two tables using the ID #. The advantage of the database is that
information doesn't need to be duplicated - you can use the relationships to
view the data how you want.
JWeaver said:
Thanks, that works great for searching for records for a particular employee
but what I want to do is choose the employee # then have the last name, first
name, and pay rate fields completed automatically for new records so that I
don't have to type this information each time and also to ensure that the
information stays consistent. The employee information is in a separate
table called Employee Names.

Thanks in advance for any help you might be able to give me!
--
JWeaver


Golfinray said:
You need to have fields in the table that you want to store the subform data
in. Then let the subform wizard create the subform so that it will link
properly. If you are not storing, it is probably one of the two. Also make
sure the table you are storing those files in are editable (arrow and
asterisk at the bottom.) Then you could use a combo box to search with. Put a
combo on the main form (let the combo wizard create that for you.) Go to the
properties of the combo and right click. Go to events, afterupdate, and start
the code builder and type:
Me.filter = "[yourtablefieldyouwanttosearchon] = """ & Me.combo & """"
Me.filteron=true

combo will be combo8 or combo16 or whatever number it assigns.

JWeaver said:
I have a Main Form that I use to enter payroll information for a full week to
track total hours worked but I want to add a Sub Form that will track details
for that week for hours worked each day of that week. I have attempted this
several times but am having difficulties getting it to work. I tried this
for one record and entered all information on the Main Form and Sub Form.
But when I went back to the record, the Sub Form details were no longer
there. However, I looked at the Sub Form table and the details are listed.

I linked the Forms together using an ID field from the Main Form to a Detail
ID in the Sub Form.

Any help would be greatly appreciated.

Thanks,
 

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