Hi unclejoe,
Thank you for your post. I'm sorry if my original post was not clear - let me try and clarify.
I have a form with a button on it that runs a query. Parameters and options for that query, of 3 types are set from listboxes/comboboxes on the form:
- Critieria for each field (=list box where user selects the values they want to include, or selects nothing to include all values)
- Fields to include in output (=list box of all fields which are available for display in the query output. The user selects which fields they want, or makes no selections to include them all)
- Options to set the sort order for the records in the query result (=3 combo boxes which the user can use to set up to three things to sort by).
One these selections have been made, the user presses "Run Query" and an SQL statement is generated based on their selections. This is saved as a query and the result opens as a datasheet view.
Now, my problem is that this datasheet view, in many cases, is editable, with changes updating the tables behind the query. I do not want this to be the case: rather, I want the query result datasheet to be read only.
I understand from posts in this thread that I could potentially achieve this by displaying the results not as a datasheet but as a continuous form. However, this would require very complex VBA because the fields that are displayed on the form would be different every time the query is run: depending on which fields the user has selected to include on the original form where they clicked "Run Query". So, the form which displayed the results would have to be created "on-the-fly" since it's fields could not be specified in advance.
I hope that this clarifies and will not allow you to see my problem. Basically, I need to do the kind of thing you propose to prevent a form being editable, but to protect a datasheet rather than a form.
Thanks in advance if you can help,
Cheers,
Gary