Please understand me on this one very carefully, I did not want to continue from the previous question that I asked before. The code listed below is working Okay after struggling to make it work. However, many thanks to your suggestions they helped a lot.
The only issue I have is that the foreign Key after inserting the record remain hidden in a combo box, so my question is that, is there a way to have this foreign key be visible as soon as the record is inserted. I do not need to do it manually otherwise there will be a lot of human errors.
The brackets are not an issue here , removing brackets access VBA throughs an error. So forget about brackets.
The only issue I have is that the foreign Key after inserting the record remain hidden in a combo box, so my question is that, is there a way to have this foreign key be visible as soon as the record is inserted. I do not need to do it manually otherwise there will be a lot of human errors.
Code:
Dim db As DAO.Database
Dim sSQL As String
Dim sSQLOne As String
Set db = CurrentDb
sSQL = "INSERT INTO [tblJobWorks] ( WorkDate, WorKorder, CompanyName )" & _
"SELECT [tblJobQuotation].[QTRDate], [tblJobQuotation].[JobNumber], [tblJobQuotation].[CustomerName]" & _
"FROM [tblJobQuotation] WHERE [tblJobQuotation].[JobQID] = " & Me.CboWorksOrder
db.Execute sSQL, dbFailOnError
sSQLOne = "INSERT INTO [tblJobworksDetails] ( Descriptions, QTY )" & _
"SELECT [tblJobQtDetails].[Description], [tblJobQtDetails].[QTY] " & _
"FROM [tblJobQtDetails] WHERE [tblJobQtDetails].[JobQID] = " & Me.CboWorksOrder
db.Execute sSQLOne, dbFailOnError
The brackets are not an issue here , removing brackets access VBA throughs an error. So forget about brackets.