rigoutsosp
New member
- Local time
- Today, 13:05
- Joined
- Mar 11, 2011
- Messages
- 8
I have created three forms and three subforms in sequence also three tables i.e.
Tables : Year-YearID, Quarter-QuarterID, Date-DateID
Α) Form Year and field YearID, Year Subform and relationship on YearID
VB code of Year subform:
B) Form Quarter and field QuarterID, Quarter Subform and relationship on QuarterID
VB Code on Quarter Form:
VB Code on Quarter Subform
C) Form Date and field DateID, Date Subform and relationship on DateID
VB Code on Date Form:
On Year Subform I point a record and then I open the Quarter Form at the selected record.
On Quarter Subform I point a record and then I open the Date Form.
Problems I face are:
a) Date Form is opened on the first record and not on the selected one.
b) When I try to open a new record on the Date Form pops up a message that record cannot be saved because is required to be recorded in the Quarter Table.
Please let me know where I am wrong bearing in mind that I am not well trained in Access.
Thanks a lot
Tables : Year-YearID, Quarter-QuarterID, Date-DateID
Α) Form Year and field YearID, Year Subform and relationship on YearID
VB code of Year subform:
Code:
[/FONT]
[FONT=Arial]Private Sub ViewRptForm()[/FONT]
[FONT=Arial] DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70[/FONT]
[FONT=Arial] DoCmd.OpenForm "Quarter", , , , acEdit[/FONT]
[FONT=Arial]End Sub[/FONT]
VB Code on Quarter Form:
Code:
[/FONT]
[FONT=Arial]Private Sub Form_Activate()[/FONT]
[FONT=Arial]On Error GoTo Err_Form_Activate[/FONT]
[FONT=Arial][/FONT]
[FONT=Arial]Me.Requery[/FONT]
[FONT=Arial][/FONT]
[FONT=Arial]DoCmd.Maximize[/FONT]
[FONT=Arial][/FONT]
[FONT=Arial]If IsLoaded("Year") Then[/FONT]
[FONT=Arial][/FONT]
[FONT=Arial] If Forms![Year]![Year Subform].Form.RecordsetClone.RecordCount > 0 Then[/FONT]
[FONT=Arial] DoCmd.GoToControl "QuarterID"[/FONT]
[FONT=Arial] DoCmd.FindRecord Forms![Year]![Year Subform].Form![QuartertID][/FONT]
[FONT=Arial] End If[/FONT]
[FONT=Arial]End If[/FONT]
[FONT=Arial]Exit_Form_Activate:[/FONT]
[FONT=Arial] Exit Sub[/FONT]
[FONT=Arial]Err_Form_Activate:[/FONT]
[FONT=Arial] MsgBox Err.Description[/FONT]
[FONT=Arial] Resume Exit_Form_Activate[/FONT]
[FONT=Arial]End Sub[/FONT]
VB Code on Quarter Subform
Code:
[/FONT]
[FONT=Arial]Private Sub ViewRptForm()[/FONT]
[FONT=Arial] DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70[/FONT]
[FONT=Arial] DoCmd.OpenForm "Date", , , , acEdit[/FONT]
[FONT=Arial]End Sub[/FONT]
C) Form Date and field DateID, Date Subform and relationship on DateID
VB Code on Date Form:
Code:
[/FONT]
[FONT=Arial]Private Sub Form_Activate()[/FONT]
[FONT=Arial]On Error GoTo Err_Form_Activate[/FONT]
[FONT=Arial] Me.Requery[/FONT]
[FONT=Arial][/FONT]
[FONT=Arial] DoCmd.Maximize[/FONT]
[FONT=Arial] [/FONT]
[FONT=Arial]If IsLoaded("Quarter") Then[/FONT]
[FONT=Arial] If Forms![Quarter]![Quarter Subform].Form.RecordsetClone.RecordCount > 0 Then[/FONT]
[FONT=Arial] DoCmd.GoToControl "DateD"[/FONT]
[FONT=Arial] DoCmd.FindRecord Forms![Quarter]![Quarter Subform].Form![DateID][/FONT]
[FONT=Arial] End If[/FONT]
[FONT=Arial]End If[/FONT]
[FONT=Arial]Exit_Form_Activate:[/FONT]
[FONT=Arial] Exit Sub[/FONT]
[FONT=Arial]Err_Form_Activate:[/FONT]
[FONT=Arial] MsgBox Err.Description[/FONT]
[FONT=Arial] Resume Exit_Form_Activate[/FONT]
[FONT=Arial]End Sub[/FONT]
On Year Subform I point a record and then I open the Quarter Form at the selected record.
On Quarter Subform I point a record and then I open the Date Form.
Problems I face are:
a) Date Form is opened on the first record and not on the selected one.
b) When I try to open a new record on the Date Form pops up a message that record cannot be saved because is required to be recorded in the Quarter Table.
Please let me know where I am wrong bearing in mind that I am not well trained in Access.
Thanks a lot
Last edited by a moderator: