A
Angi
I hope I explained that right. This is just too weird for me. My
company entry form has an Add cmd btn on it. When clicked, it's
supposed to open the CompanyMain form with the new record that was just
entered. When I use the Add New Company button on my CompanyMain form,
it opens the entry form in Add mode and closes the CompanyMain form.
Then I click the Add btn on the entry form and it saves the curr
record, re-opens the CompanyMain form with the new record and closes
itself.
If I just open the company entry form so that I can view all the
companies and then try to add a new record, it opens the CompanyMain
form but uses the first company record rather than the new one.
Furthermore, I should be able to click the add btn to fire the code and
open with the current record (new or not). That's not working either.
I can't figure out why this is happening. Sorry this sounds so
confusing.
Here's the code for the company entry form:
Private Sub cmdAdd_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "CompanyMain"
stLinkCriteria = "[CoID]=" & Me![CoID]
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm stDocName, , , , , , Me.CoID
DoCmd.Close acForm, "company", acSavePrompt
End Sub
Here's the OnOpen event for CompanyMain:
Private Sub Form_Open(Cancel As Integer)
If (Not IsNull(Me.OpenArgs)) Then
Me!CoID.DefaultValue = Me.OpenArgs
End If
End Sub
company entry form has an Add cmd btn on it. When clicked, it's
supposed to open the CompanyMain form with the new record that was just
entered. When I use the Add New Company button on my CompanyMain form,
it opens the entry form in Add mode and closes the CompanyMain form.
Then I click the Add btn on the entry form and it saves the curr
record, re-opens the CompanyMain form with the new record and closes
itself.
If I just open the company entry form so that I can view all the
companies and then try to add a new record, it opens the CompanyMain
form but uses the first company record rather than the new one.
Furthermore, I should be able to click the add btn to fire the code and
open with the current record (new or not). That's not working either.
I can't figure out why this is happening. Sorry this sounds so
confusing.
Here's the code for the company entry form:
Private Sub cmdAdd_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "CompanyMain"
stLinkCriteria = "[CoID]=" & Me![CoID]
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm stDocName, , , , , , Me.CoID
DoCmd.Close acForm, "company", acSavePrompt
End Sub
Here's the OnOpen event for CompanyMain:
Private Sub Form_Open(Cancel As Integer)
If (Not IsNull(Me.OpenArgs)) Then
Me!CoID.DefaultValue = Me.OpenArgs
End If
End Sub