Add New info to Subform?

  • Thread starter accessuser via AccessMonster.com
  • Start date
A

accessuser via AccessMonster.com

I am lost in the following situation, can someone clarify it for me on what
steps to take. i have a main form called "frmEmp", subform with employee
course information using CourseID and next to the courseID field, there is a
"Detail" Command button. "Detail" Command will filter and open up that one
specific course Cost information. I am thinking of adding a command called
"Add Cost" next to the "Detail" command, and the form will pop up so that I
can fill in the information whenever employee wants to sign up for a new
course. I have thought of having two subforms in one Main form, but the cost
form has too many fields. By having one Main form, Subform, and another Cost
form that's link to the Subform, will the information link correctly?
Currently my main form and subform have no problems of linking. Will Access
still read each other even though the Cost form and the CourseInfo Subform
are not in the same Main Form?

TblEmp
TblCourseInfo
TblCost

QryEmpSort
QryCourseInfo
QryCost


Thanks in advance!
 
T

tina

By having one Main form, Subform, and another Cost
form that's link to the Subform, will the information link correctly?
Currently my main form and subform have no problems of linking. Will Access
still read each other even though the Cost form and the CourseInfo Subform
are not in the same Main Form?

no. Access will not automatically link two forms opened in separate windows,
regardless of what relationship has been established between them in the
Relationships window.

you can use code to "link" a pop-up form to the form that opened it, or you
could add the Details form to frmEmp, as a second subform (you can use a tab
control to give you more "real estate" to work with), and set up an indirect
link between the two subforms.

but i'm wondering about your table structure. you have a tblEmployees, a
table EmployeeCourses (to list each course the employee takes, correct?),
and a tblDetails that stores specific course cost data. is tblDetails
the -many table in a one-to-many relationship with tblEmployeeCourses? if
so, why? does the cost data for course X differ between employees Sue, Mary,
and Tom? can you explain your tables/relationships structure?

hth
 
A

accessuser via AccessMonster.com

Yes, every employee has different cost and we want to track that. TblEmp has
One to Many "Delete related record" relationship with TblCourseInfo, and
TblCourseinfo also has the same relationship with the TblCost. I can't put
another subform into my frmEmp, because it is just too many fields, and my
forms will expand so big and will very hard for users to see.

The tblCourseinfo has CourseID as PrimaryKey that links to the TblCost
table's CourseID. The courseID on the tblCost is a number field. If i do a
"Add" command on the fsubCourseInfo, and just make sure enter the courseID
that generated from the FsubCourseInfo, wouldn't it link? HOw do i add a
"Add" Command. do I just treat it as a regular OpenForm command?

Thanks!!!
By having one Main form, Subform, and another Cost
form that's link to the Subform, will the information link correctly?
Currently my main form and subform have no problems of linking. Will Access
still read each other even though the Cost form and the CourseInfo Subform
are not in the same Main Form?

no. Access will not automatically link two forms opened in separate windows,
regardless of what relationship has been established between them in the
Relationships window.

you can use code to "link" a pop-up form to the form that opened it, or you
could add the Details form to frmEmp, as a second subform (you can use a tab
control to give you more "real estate" to work with), and set up an indirect
link between the two subforms.

but i'm wondering about your table structure. you have a tblEmployees, a
table EmployeeCourses (to list each course the employee takes, correct?),
and a tblDetails that stores specific course cost data. is tblDetails
the -many table in a one-to-many relationship with tblEmployeeCourses? if
so, why? does the cost data for course X differ between employees Sue, Mary,
and Tom? can you explain your tables/relationships structure?

hth
I am lost in the following situation, can someone clarify it for me on what
steps to take. i have a main form called "frmEmp", subform with employee
[quoted text clipped - 19 lines]
Thanks in advance!
 
A

accessuser via AccessMonster.com

i have the following code for the "Detail Command"

Private Sub cmdDetails_Click()
Dim strWhere As String
If Not IsNull(Me!CourseID) Then
strWhere = "CourseID = " & Me!CourseID
DoCmd.OpenForm "frmCost", WhereCondition:=strWhere
End If
End Sub

It works great and i have no problem for that. This code is set up to filter
the course, and I can't do any additions to the frmcost. Any code that will
work something like this but allows me to add new info and have the CourseID
prefilled from the Subform?

Thanks!
Yes, every employee has different cost and we want to track that. TblEmp has
One to Many "Delete related record" relationship with TblCourseInfo, and
TblCourseinfo also has the same relationship with the TblCost. I can't put
another subform into my frmEmp, because it is just too many fields, and my
forms will expand so big and will very hard for users to see.

The tblCourseinfo has CourseID as PrimaryKey that links to the TblCost
table's CourseID. The courseID on the tblCost is a number field. If i do a
"Add" command on the fsubCourseInfo, and just make sure enter the courseID
that generated from the FsubCourseInfo, wouldn't it link? HOw do i add a
"Add" Command. do I just treat it as a regular OpenForm command?

Thanks!!!
By having one Main form, Subform, and another Cost
form that's link to the Subform, will the information link correctly? [quoted text clipped - 25 lines]

Thanks in advance!
 
A

accessuser via AccessMonster.com

I made it to work now, instead of using another form, i would just use the
detail form so that they can add new cost info by the courseID since it is
the foreign key to the Subform PK.

Thanks!!
i have the following code for the "Detail Command"

Private Sub cmdDetails_Click()
Dim strWhere As String
If Not IsNull(Me!CourseID) Then
strWhere = "CourseID = " & Me!CourseID
DoCmd.OpenForm "frmCost", WhereCondition:=strWhere
End If
End Sub

It works great and i have no problem for that. This code is set up to filter
the course, and I can't do any additions to the frmcost. Any code that will
work something like this but allows me to add new info and have the CourseID
prefilled from the Subform?

Thanks!
Yes, every employee has different cost and we want to track that. TblEmp has
One to Many "Delete related record" relationship with TblCourseInfo, and
[quoted text clipped - 15 lines]
 

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