I have three forms: Quotations, Custom Quotations, and Custom QuotationsDetai ls. If I have a basic quote for a customer I need to make I just use Quotations, but if it requires more in-depth details such as extra parts or labor I need to use Custom Quotations to add these. I fill out the CustomQuotation s form that pops up and when I close it it fills in the information in the main Quotations page. Custom Quoatation Details is a subform inside CustomQuotation s that holds each line for a part.
Right now I can only have one Custom Quote per "Quotations " page. I want to be able to have more than one custom item per quote, but when I click the next record or new record button at the bottom of the Custom Quotations, I get an error in line 3 of the below code: "Syntax error (missing operator) in query expression 'QuoatationID=' " If I comment those lines out (do I really need to check that?) I get an error "Syntax error in INSERT INTO statement" (line 4 of below code) I think the problem for that one is when I debug and mouse-over the "[QuotationID]" text in line 4 of below code, QuotationID is Null.
I also think maybe I need to change how the relationships are set up. What types should I have between the tables?
Right now I can only have one Custom Quote per "Quotations " page. I want to be able to have more than one custom item per quote, but when I click the next record or new record button at the bottom of the Custom Quotations, I get an error in line 3 of the below code: "Syntax error (missing operator) in query expression 'QuoatationID=' " If I comment those lines out (do I really need to check that?) I get an error "Syntax error in INSERT INTO statement" (line 4 of below code) I think the problem for that one is when I debug and mouse-over the "[QuotationID]" text in line 4 of below code, QuotationID is Null.
Code:
Private Sub Form_Current()
If DCount("QuotationID", "Quotation_Custom", "QuotationID=" & [QuotationID]) = 0 Then
CurrentDb.Execute ("INSERT INTO Quotation_Custom (QuotationID, Shipping, Markup, Commission, Exchange) VALUES (" & [QuotationID] & ", .1, .85, 0, .81);")
Me.Refresh
End If
End Sub
Comment