I am using Access 2000.
I believe that I have the right code for the "Insert into and where" Portion:
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO [tblJobs]([QuoteNumber],
[CustomerID],[JobDescription],[BidHours],[JobCosts],[JobRevenue])
Values(tblQuotes.QuoteNumber, tblQuotes.CustomerID, tblQuotes.ProductName, tblQuotes.LaborHours, tblQuotes.MaterialTotal, tblQuotes.GrandTotal)"
WHERE (((tblJobs.QuoteNumber) <> [Forms]![frmQuotes]![QuoteNumber]))
DoCmd.SetWarnings True
But I want to check the table (tblJobs.QuoteNumber) that I'm inserting into for the QuoteNumber in the current form so the I can messagebox the user that there already is a job in tblJobs with that Quotenumber. How would I do this?
One way I tried to do this was to do a make-table query of tblJobs (that I want to insert into) for the QuoteNumber of the current form, which works fine, but I don't know how to reference the table and field from VBA.
Thanks,
Niko
I believe that I have the right code for the "Insert into and where" Portion:
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO [tblJobs]([QuoteNumber],
[CustomerID],[JobDescription],[BidHours],[JobCosts],[JobRevenue])
Values(tblQuotes.QuoteNumber, tblQuotes.CustomerID, tblQuotes.ProductName, tblQuotes.LaborHours, tblQuotes.MaterialTotal, tblQuotes.GrandTotal)"
WHERE (((tblJobs.QuoteNumber) <> [Forms]![frmQuotes]![QuoteNumber]))
DoCmd.SetWarnings True
But I want to check the table (tblJobs.QuoteNumber) that I'm inserting into for the QuoteNumber in the current form so the I can messagebox the user that there already is a job in tblJobs with that Quotenumber. How would I do this?
One way I tried to do this was to do a make-table query of tblJobs (that I want to insert into) for the QuoteNumber of the current form, which works fine, but I don't know how to reference the table and field from VBA.
Thanks,
Niko