Originally Posted by
bbrazeau
I have a one to one relationship between tables Rfqs and Quotes.
I have a form "frmRfq" that has a button "cmdNewQuote" it opens the "frmQuotesAdd" with:
Private Sub cmdNewQuote_Click()
If DCount("QuoteID", "tblQuotes", "QuoteID =" & Me.RfqID) = 0 Then
DoCmd.OpenForm "frmQuotesAdd", , , , acFormAdd
Else
MsgBox ("This Rfq already has a quote")
End If
End Sub
When I run the code I get a dialog box similar to a parameter query asking for the Rfq. My question is...Is this something access does automatically with a one to one relationship or is there a mistake in my code? P.S. I use the On Load event of "frmQuotesAdd" to set the QuoteId to the current RfqId.
Private Sub Form_Load()
Me.QuoteID = Forms!frmRfqs!RfqID
Me.Form.AllowAdditions = False
End Sub