OTWarrior
02-22-2017, 06:22 AM
Hello
I am linking to an excel file (Word list.xlsx), in order to see if the results of a query are within the spreadsheet.
The table/xlsx file has just two columns:
"sWord"
"Senti"
When I am checking the current value against the table, if the "Word" field doesn't have this , I am prompting the user to confirm it's value (for use elsewhere in the database).
What I am needing, is to put the missing "sWord" and "Senti" into the original Excel file.
I have thought about using an Access query, but when I have tried to use it, it says the file is in use (which is strange, as I can open the xslx file in explorer and edit with no issue).
Function addNEWtoSenti(sWordval As String, SentiVal As String)
Dim db As Database
Dim rec As Recordset
Set db = CurrentDb
Set rec = db.OpenRecordset("Select * from Table")
rec.AddNew
rec("sWord") = sWordval
rec("Senti") = SentiVal
rec.Update
Set rec = Nothing
Set db = Nothing
End Function
1) Is an append query the way to go?
2) Do I need to unlink the file and re-link it for this to work?
Thanks all
I am linking to an excel file (Word list.xlsx), in order to see if the results of a query are within the spreadsheet.
The table/xlsx file has just two columns:
"sWord"
"Senti"
When I am checking the current value against the table, if the "Word" field doesn't have this , I am prompting the user to confirm it's value (for use elsewhere in the database).
What I am needing, is to put the missing "sWord" and "Senti" into the original Excel file.
I have thought about using an Access query, but when I have tried to use it, it says the file is in use (which is strange, as I can open the xslx file in explorer and edit with no issue).
Function addNEWtoSenti(sWordval As String, SentiVal As String)
Dim db As Database
Dim rec As Recordset
Set db = CurrentDb
Set rec = db.OpenRecordset("Select * from Table")
rec.AddNew
rec("sWord") = sWordval
rec("Senti") = SentiVal
rec.Update
Set rec = Nothing
Set db = Nothing
End Function
1) Is an append query the way to go?
2) Do I need to unlink the file and re-link it for this to work?
Thanks all