Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error....would have no record on the one side

Status
Not open for further replies.

lind77

Technical User
Oct 17, 2003
14
NL
Hi,

I have designed two forms, one of which has a subform. I can access and both independently and alter the controls. However, when I try to open the one with the subform from the other and then enter data I get an error stating that '.....would have no record on the one side' and also that the action has been cancelled by the user. I have checked the relationships, especially the one to many ones, and they all seem to be fine. Only when I open the second form using he first does this problem occur.

Does anyoe know what is going wrong?

Thanks,

Mark
 
Can you post the code that opens the 2nd form?

Ken S.
 
Here you go.... The error seems to pop up randomly, sometimes it doesn't occur and sometimes I have to press the 'go to last record' button up to 5 times before the error is no longer displayed. Thanks for your trouble.

' Main Page is cont. form with all visitnumbers listed.
' QuickLMOForm entry by clicking button on Main Page or DoubleClick Vistnumber Field
' [Visit nr] is VisitNumberField of selected record

Private Sub QuickOpenOvergave_Click()
On Error GoTo Err_QuickOpenOvergave_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "QuickLMOForm"
stLinkCriteria = "[Visit nr]=" & "'" & Me![Visit nr] & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_QuickOpenOvergave_Click:
Exit Sub

Err_QuickOpenOvergave_Click:

MsgBox Err.Description

Resume Exit_QuickOpenOvergave_Click

End Sub
 
Okay, is the first form still dirty when you open the 2nd form? Just a guess, but I suspect what's happening is you have set referential integrity in your relationships, and the data in the 2nd form is related to the record in the first form - so if the first form is still dirty, i.e. the record hasn't yet been written to the table, when you open the 2nd form, you're trying to create a record for which no related record yet exists. You might try inserting this code before the line that opens the 2nd form:

Code:
DoCmd.RunCommand acCmdSaveRecord

HTH...

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top