I have a database with a SQL back end. This is the process I am currently debugging:
1) Open application to Main menu
2) Click button on main menu to go to the "Main Record Form"
3) Main record form has detail hidden until an existing record is found or a new record is added (2 buttons on form header)
4) Click to add a new record. A pop-up form opens and the "Main Record" form is made visible = false
4.a) The pop-up form is so the user can choose a "contact" and a "match", as the hierarchy is contact --> match --> main record. A User must assign a new record to a match, being that each match belongs to a contact.
4.b) Click a button on the pop-up form, and on the main form, code is run to go to a new record, updating the match FK into that record
4.c) the pop-up form is closed, and the "Main Record" form is made visible, but it doesn't look like the form is really on the record it should be on
5) Another option is to find an existing main record.
5.a) choose from 2 drop downs - contact and/or match, to filter the main records listbox listing of all records, which are subsets of contacts --> matches
5.b) choose a record from listbox, and click button to go back to main record form
All of this is complicated because I'm trying to control which pages on a tab control are visible, based on the main record's sub requirement records. A main record can have many requirements, which are set on a subform, which exists on 1 page of the tab control. I have a tblReqType table, with the requirement types. This has a column called txtRequirementPage, which has the exact name of the corresponding tab control page. Not all requirements have a page, so some will be null. The requirement pages only correspond to 1 requirement type. So 15 tabs, 9 correspond to a requirement type. There are 12 requirement types, only 9 of which have a corresponding page to be visible or not, based on the main record having that requirement.
This is the public function I have been working on, to ensure only the tab control pages that should be visible, are.
It looks like it sets them all not visible, when I go to a contract that has no requirement sub records. It flips one on (page = visible) , when I add one (sub record/requirement record), but when I add another, it makes the first go away, and flickers and doesn't seem to do the proper visible/not visible setting to correspond to the main record's current sub requirement records.
Any help would be greatly appreciated!
Thanks!
ps. I started this in a different thread, edited and wanted to delete it (because it wasn't my main issue, and wasn't formed well), but I can't seem to delete it.
misscrf
It is never too late to become what you could have been ~ George Eliot
1) Open application to Main menu
2) Click button on main menu to go to the "Main Record Form"
3) Main record form has detail hidden until an existing record is found or a new record is added (2 buttons on form header)
4) Click to add a new record. A pop-up form opens and the "Main Record" form is made visible = false
4.a) The pop-up form is so the user can choose a "contact" and a "match", as the hierarchy is contact --> match --> main record. A User must assign a new record to a match, being that each match belongs to a contact.
4.b) Click a button on the pop-up form, and on the main form, code is run to go to a new record, updating the match FK into that record
4.c) the pop-up form is closed, and the "Main Record" form is made visible, but it doesn't look like the form is really on the record it should be on
5) Another option is to find an existing main record.
5.a) choose from 2 drop downs - contact and/or match, to filter the main records listbox listing of all records, which are subsets of contacts --> matches
5.b) choose a record from listbox, and click button to go back to main record form
All of this is complicated because I'm trying to control which pages on a tab control are visible, based on the main record's sub requirement records. A main record can have many requirements, which are set on a subform, which exists on 1 page of the tab control. I have a tblReqType table, with the requirement types. This has a column called txtRequirementPage, which has the exact name of the corresponding tab control page. Not all requirements have a page, so some will be null. The requirement pages only correspond to 1 requirement type. So 15 tabs, 9 correspond to a requirement type. There are 12 requirement types, only 9 of which have a corresponding page to be visible or not, based on the main record having that requirement.
This is the public function I have been working on, to ensure only the tab control pages that should be visible, are.
Code:
Public Function ShowRequirements(MCID As Integer)
Dim db As DAO.Database
Dim db2 As DAO.Database
Dim strRstVTrue As String
Dim rstvTrue As DAO.Recordset
Dim strRstVFalse As String
Dim rstvFalse As DAO.Recordset
Dim strFieldName As String
'Setup the recordset
Set db = CurrentDb
Set db2 = CurrentDb
strRstVTrue = "SELECT tblMRecordRequirements.ID, tblMRecordRequirements.FKMC, tblReqType.txtRequirementPage " & _
"FROM tblMRecordRequirements LEFT JOIN tblReqType ON tblMRecordRequirements.FKRequirementType = tblReqType.ID " & _
"WHERE tblReqType.txtRequirementPage Is Not Null AND tblMRecordRequirements.FKMC Is Null"
strRstVFalse = "SELECT tblReqType.ID, tblReqType.txtRequirementPage, tblMRecordRequirements.FKMC " & _
"FROM tblReqType LEFT JOIN tblMRecordRequirements ON tblReqType.ID = tblMRecordRequirements.FKRequirementType " & _
"WHERE tblReqType.txtRequirementPage Is Not Null AND tblMRecordRequirements.FKMC Is Null"
Set rstvTrue = db.OpenRecordset(strRstVTrue, dbOpenDynaset, dbSeeChanges)
Set rstvFalse = db2.OpenRecordset(strRstVFalse, dbOpenDynaset, dbSeeChanges)
strFieldName = "txtRequirementPage"
Do While Not rstvTrue.EOF
Forms!frmMRecords.tbMRecordSubs.Pages(rstvTrue.Fields(strFieldName)).Visible = True
rstvTrue.movenext
Loop
Do While Not rstvFalse.EOF
Forms!frmMRecords.tbMRecordSubs.Pages(rstvFalse.Fields(strFieldName)).Visible = False
rstvFalse.movenext
Loop
End Function
It looks like it sets them all not visible, when I go to a contract that has no requirement sub records. It flips one on (page = visible) , when I add one (sub record/requirement record), but when I add another, it makes the first go away, and flickers and doesn't seem to do the proper visible/not visible setting to correspond to the main record's current sub requirement records.
Any help would be greatly appreciated!
Thanks!
ps. I started this in a different thread, edited and wanted to delete it (because it wasn't my main issue, and wasn't formed well), but I can't seem to delete it.
misscrf
It is never too late to become what you could have been ~ George Eliot