T
ThomasK via AccessMonster.com
I have a form where I enter address records. Its based on the table
"Addresses". It has a comand button which opens another form based on a
related table (occupancy). The problem that Im having is that after I enter a
record in the address form and click the comand button to open the other form
an error message comes up stating that I must first save the record in the
related (address) table. If I go to the menu and select Save Record before I
hit the comand button to open the form the error does not come up. This is
what I have on the comand button code.....
Private Sub cmdOpenOccupancy_Click()
On Error GoTo Err_cmdOpenOccupancy_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmOccupancy"
stLinkCriteria = "[AddressID]=" & Me![AddressID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpenOccupancy_Click:
Exit Sub
Err_cmdOpenOccupancy_Click:
MsgBox Err.Description
Resume Exit_cmdOpenOccupancy_Click
End Sub
Is there some way to add a save or something so that the address record saves
when I click the comand button? The address form stays open after the
occupancy form is opened.
Thanks
"Addresses". It has a comand button which opens another form based on a
related table (occupancy). The problem that Im having is that after I enter a
record in the address form and click the comand button to open the other form
an error message comes up stating that I must first save the record in the
related (address) table. If I go to the menu and select Save Record before I
hit the comand button to open the form the error does not come up. This is
what I have on the comand button code.....
Private Sub cmdOpenOccupancy_Click()
On Error GoTo Err_cmdOpenOccupancy_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmOccupancy"
stLinkCriteria = "[AddressID]=" & Me![AddressID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpenOccupancy_Click:
Exit Sub
Err_cmdOpenOccupancy_Click:
MsgBox Err.Description
Resume Exit_cmdOpenOccupancy_Click
End Sub
Is there some way to add a save or something so that the address record saves
when I click the comand button? The address form stays open after the
occupancy form is opened.
Thanks