tjarko großmann
tjarko großmann

Reputation: 33

run access insert query with button from form

hey is there a way to only run a saved insert query in access 2013 from a comandbutton and not show it? I alredy have a query that workes if i execute it from the query itselfe but i cant get i working from the form

i have tried it with the vba methode

dbs.Execute and than the sql statement as string

but that doesn't work and i tried the

OpenQuery "myqry"

but that does only show me a table with the values i want to insert but doesn't realy insert them.

Upvotes: 1

Views: 1633

Answers (1)

Shazu
Shazu

Reputation: 587

DoCmd.OpenQuery ("myqry")

should be sufficient. Make sure that this code is assigned to the on-click event of your button. Another option is to assign a macro to the on-click event of your button for the same purpose. The macro can be selected from the dropdown list and is titled 'Open Query'. After selecting this macro, you need to select the query name and that's it.

Upvotes: 1

Related Questions