If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
SUBFORM - AUTO POPULATE PRIMARY KEY
Main Form: School
Subform: Courses (1 to many from School) Subform2: Sites (1 to many from Courses) Everything works fine when the form and both subforms are displayed. When I add a record to subform2 the Courses ID auto-populates which I want. However, when I open Subform2 from an action button and click add record, the Course ID does not auto-populate. Help? Thanks... |
#2
|
|||
|
|||
SUBFORM - AUTO POPULATE PRIMARY KEY
On Thu, 6 Mar 2008 10:52:00 -0800, -LWG-
wrote: Main Form: School Subform: Courses (1 to many from School) Subform2: Sites (1 to many from Courses) Everything works fine when the form and both subforms are displayed. When I add a record to subform2 the Courses ID auto-populates which I want. However, when I open Subform2 from an action button and click add record, the Course ID does not auto-populate. Help? What's the Recordsource of each form? Post the SQL. Why should CourseID autopopulate, if it's not (part of) the master/child link field? -- John W. Vinson [MVP] |
#3
|
|||
|
|||
SUBFORM - AUTO POPULATE PRIMARY KEY
Reason is simple.
I has NO idea what course ID to use since it is not a child of anything when you open the form independently. If sites is really independent of courses and/or School, then it should be a separate table of JUST sites and what you select in form 2 should be a table that contains the courseID and the selected Site id. If site is entirely dependent on course then it should never be created except in a situation where the system can know what course is involved. Ron |
#4
|
|||
|
|||
SUBFORM - AUTO POPULATE PRIMARY KEY
IT has no idea......
|
#5
|
|||
|
|||
SUBFORM - AUTO POPULATE PRIMARY KEY
On Fri, 7 Mar 2008 07:14:25 -0800 (PST), Ron2006 wrote:
Reason is simple. I has NO idea what course ID to use since it is not a child of anything when you open the form independently. If sites is really independent of courses and/or School, then it should be a separate table of JUST sites and what you select in form 2 should be a table that contains the courseID and the selected Site id. If site is entirely dependent on course then it should never be created except in a situation where the system can know what course is involved. Ron I'm completely lost here, Ron. Are you asking me to explain your requirements specs to you? I have no idea even what a Site is; how a course is related to a site, etc. You say IT is no help (well, that's not unusual :-{( ), but you have not - that I have seen anyway - posted a human-readable description of the problem that you are trying to solve. Let's step back a bit - what will people out in the real world actually DO with this database? -- John W. Vinson [MVP] |
#6
|
|||
|
|||
SUBFORM - AUTO POPULATE PRIMARY KEY
John,
It is called "finger forgetfullness" (AND not re-reading my post thoroughly before saying "Send") I was trying to say that the subform (IT that I typed as I) did not know what course ID to give to the site since the subform was being opened independently and therefore did NOT have the actual associated ID to load. And the comments are all directed to LWG. Ron. Sorry for the confusion |
#7
|
|||
|
|||
SUBFORM - AUTO POPULATE PRIMARY KEY
School (Main Form) record source = School
Courses (Sub Form 1) record source = Courses. Master/Child = School ID. Sites (Sub Form 2) record source = Sites. Master/Child = Course ID. The database needs to do this: 1 School has many Courses. Each course has many sites. From the Course subform (to Schools) I want an action button that filters the sites for the selected course... Thanks... "John W. Vinson" wrote: On Thu, 6 Mar 2008 10:52:00 -0800, -LWG- wrote: Main Form: School Subform: Courses (1 to many from School) Subform2: Sites (1 to many from Courses) Everything works fine when the form and both subforms are displayed. When I add a record to subform2 the Courses ID auto-populates which I want. However, when I open Subform2 from an action button and click add record, the Course ID does not auto-populate. Help? What's the Recordsource of each form? Post the SQL. Why should CourseID autopopulate, if it's not (part of) the master/child link field? -- John W. Vinson [MVP] |
#8
|
|||
|
|||
SUBFORM - AUTO POPULATE PRIMARY KEY
On the MainForm that is bound to school, place and UNBOUND Txtbox
named txtThisCourseID - make visible property False. In the Oncurrent event of the Course subform have it move the Course ID to the field you just created. Forms![MainForm]![txtThisCourseID] = me.CourseIDname. In the FORM Property window in the Form Tab use the wizard to establish the master/Child relationship between this subform and the "MainFomr" txtThisCourseID. This will automatically filter all sites for this course for this school, and will automatically load the courseID into the site record you create there. Ron |
Thread Tools | |
Display Modes | |
|
|