hi
i have 3 basic queries in a database and i want to be able to run those when the database is opened. i have tried using VBA but get an error, this is what i have so far -VB Code:
Sub run() DoCmd.RunSQL "INSERT INTO [currency] ( currencyName, euroRate )" & _ "SELECT Template.Code, Template.[Rate vs EUR]" & _ "FROM Template " & _ "WHERE (((Template.Code) In ('GBP','USD','HKD')));" DoCmd.RunSQL "INSERT INTO [currency] ([currencyName], [euroRate])" & _ " VALUES ('EUR', '1.0000');" DoCmd.RunSQL "SELECT currency.currencyName, currency.euroRate, (currency!euroRate/currency_1 !euroRate) AS dollarRate " & _ "FROM [currency], [currency] AS currency_1 " & _ "WHERE (((currency_1.currencyName)='USD'));" End Sub
the first 2 queries run fine, but then i get an error stating that 'A RunSQL action require an argument consisting of an SQL statement'![]()
any help much appreciated
jimmyp


Reply With Quote
