I have two tables - tblAssets and tblAssetNo
tblAssets is the main db table
tblAssetNo has only one record that keeps track of the latest asset number.
I have a form to add a new asset with a bound control called AssetNo. I am trying to use the following code to get the next asset number from tblAssetNo and place it in the AssetNo control on the form:
Dim SQL As String
DoCmd.GoToRecord , , acNewRec
SQL = "SELECT AssetNo FROM tblAssetNo"
DoCmd.RunSQL SQL
When I run the code, I get error 2342
"A RunSQL action requires an argument consisting of an SQL statement". I can use the SQL string in a query and it retrieves the record.
What am I doing wrong?
tblAssets is the main db table
tblAssetNo has only one record that keeps track of the latest asset number.
I have a form to add a new asset with a bound control called AssetNo. I am trying to use the following code to get the next asset number from tblAssetNo and place it in the AssetNo control on the form:
Dim SQL As String
DoCmd.GoToRecord , , acNewRec
SQL = "SELECT AssetNo FROM tblAssetNo"
DoCmd.RunSQL SQL
When I run the code, I get error 2342
"A RunSQL action requires an argument consisting of an SQL statement". I can use the SQL string in a query and it retrieves the record.
What am I doing wrong?