Rich,
I actually changed all my queries, forms, and field names to not include spaces and try to use the standard naming conventions you mentioned. So some of the database that I sent you has changed, hopefully for the better.
The first form that is viewed is: frmMaintForm, which is called using the query: qryMaintFormByIcao. This query uses the criteria for ICAO [Enter ICAO], which lets the user select the ICAO to view. (ICAO is a 4 letter identifier for airports) So the first form opens after the user selects the airport to view.
There is a list box that contains all the instrument procedures for the airport on the frmMaintForm. I have the list box setup to allow the user to double click on the instrument procedure they want to view details of.
The form that opens is frmHostNationViewProcedure. This is the main form that procdedure information is on. The form is linked to the procedure by the field ProcedureID, so just information for the procedure that was double clicked is shown.
My plan is to have a number of sub forms on the main form (frmHostNationviewProcedure)to display various information for each procedure. One of the sub forms is frmPtasView. (Actually I want to have 4 subforms on different tabs, I just need to figure out how to get the PTAS subform to work first.)
The frmPtasView is the form I used for the PTAS sub form which I named frmPtasViewSubform.
The source object for frmPtasViewSubform is frmPtasView. The link child fields = ProcedureID and the link master fields = ProcedureID
There are 2 cmd buttons on the frmPtasForm, which is the form that is in the subform. They both open a new forms, frmPtasEdit (to edit the ptas that is currently on the subform) and frmPtasNew (to enter a new PTAS for the given procedure).
The code for frmPtasNew is:
Private Sub cmdPtasNew_Click()
On Error GoTo Err_cmdPtasNew_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPtasNew"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord acDataForm, stDocName, acNewRec
Forms!frmPtasNew!ProcedureID = Me.ProcedureID
Exit_cmdPtasNew_Click:
Exit Sub
Err_cmdPtasNew_Click:
MsgBox Err.Description
Resume Exit_cmdPtasNew_Click
End Sub
This code allows me to enter a new PTAS related to the procedureID of the procedure on the main form (frmHostNationviewProcedure) but only if a PTAS record already exists. If no PTAS record exists for that procedure, then a procedure with a ProcedureID of 0 is called up on the frmPtasNew form.
And I could not get the EditPtas code to work:
Private Sub cmdPtasEdit_Click()
On Error GoTo Err_cmdPtasEdit_Click
DoCmd.OpenForm "frmPtasEdit"
Forms!frmPtasEdit!ProcedureID = Me.ProcedureID
Exit_cmdPtasEdit_Click:
Exit Sub
Err_cmdPtasEdit_Click:
MsgBox Err.Description
Resume Exit_cmdPtasEdit_Click
End Sub
I want this code to open the frmPtasEdit form at the same record that is being displayed on the frmHostNationViewProcedure when the cmd button cmdPtasEdit is clicked.
The frmPtasView uses qryPtasView for the fields on the subform, but I don’t understand how the query qryPtasView is preventing new additions. I am also unsure of what you mean by remove some of the tables and display them as subs of the sub or change the joins.
I feel like I am getting very close to getting this figured out.
In case I am being as clear as mud, I can send you my latest attempt at this project, if you have the time.
Thanks,
Mike