In the SQL string below, the "Main_Family" field needs to be controlled by the variable "dFamily".
I need to run the same basic SQL with the "Family" data going into different fields..
This occurs n the "INSERT INTO" and "WHERE" clauses.
I have tried fields(dFamily) to no avail AI has been no help.
I would also like to insert sStr into a "Notes" field
These are the relevant fields of the two tables.
I need to run the same basic SQL with the "Family" data going into different fields..
This occurs n the "INSERT INTO" and "WHERE" clauses.
I have tried fields(dFamily) to no avail AI has been no help.
Code:
Public Sub inToDisc(dFamily As String, sFamily As String, nAccno As Double, sStr As String)
oDB.Execute "INSERT INTO Discrepancies( Accession, Main_Family, Genus, Infra, Raw_Box, Collection) " & _
"SELECT B.Accession, B.Family, B.Genus, B.Infra, B.BoxNo, B.Collection " & _
"FROM Boxes2 as B LEFT JOIN Discrepancies as A ON A.Accession = B.Accession " & _
"WHERE A.Main_Family ='" & sFamily & "'" & _
"AND B.Accession = " & nAccno & _
"AND A.Raw_Box = B.boxno ;", dbFailOnError
End Sub
I would also like to insert sStr into a "Notes" field
These are the relevant fields of the two tables.