add record to sub sub form?

hilbertm

Registered User.
Local time
Today, 02:01
Joined
Sep 7, 2001
Messages
46
I posted this in the VBA area but no replies.
I wonder if a form expert can help.

I have a form that contains airport information. It opens with a query where the user selects the airport to view. Once the form opens, the user can navigate through the instrument procedures at the selected airport (on the main form). I have a sub form (on a tab control) linked to the airport info on the main form to show ptas information for each instrument procedure. I can cycle through the PTAS' for the selected instrument procedure on the main form. I would like to have a form open (PTASEnter form)when a cmd button is pressed to enter new ptas information for the instrument procedure that is displayed on the main form.
The ptas table and the instrument procedure table are linked with the field PROCEDURE ID

I am using the following code to open a form for the user to enter data.

Private Sub EnterNewPTAS_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PTASEnter"
stLinkCriteria = "[PROCEDURE ID]=" & Me![PROCEDURE ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_EnterNewPTAS_Click:
Exit Sub
Err_EnterNewPTAS_Click:
MsgBox Err.Description
Resume Exit_EnterNewPTAS_Click
End Sub
The procedure ID on the PTASEnter form does not match the procedure ID on the main form when I try to enter a new record. The program tries to add a new record to the Procedures table (data on the main form). The funny thing is that I can edit ptas information on the PTASEnter form if data is already in the PTAS table.

I want the form to open with a new record so the user can enter new ptas information. I also want to keep the subform read only so the users can only view the info on the sub form.

I have limited VBA experence but I try to struggle my way through. Maybe someday I can be giving advice rather than needing it.
smile.gif
.


Thanks in advance for any help.
 

Users who are viewing this thread

Back
Top Bottom