Unbound Form - Using Query

accessNator

Registered User.
Local time
Today, 15:18
Joined
Oct 17, 2008
Messages
132
Can anyone point me to an example where there is a vba code to create a query and bound the result to a form?

This allows the user to see the result, but cannot directly edit the information so it wont affect the data from the underlying table. But if the user wants to edit the information, the user can make the edit then click on a save button to update the record, possible delete the record too.

I want to get away from creating a form that is directly bound to a query or table which the user can make edits to the record.

Thanks for any information.
 
Can anyone point me to an example where there is a vba code to create a query and bound the result to a form?

This allows the user to see the result, but cannot directly edit the information so it wont affect the data from the underlying table. But if the user wants to edit the information, the user can make the edit then click on a save button to update the record, possible delete the record too.

I want to get away from creating a form that is directly bound to a query or table which the user can make edits to the record.

Thanks for any information.
Why not just bind the form anyway and set the

AllowAdditions = No
AllowEdits = No
AllowDeletions = No

and then it can't be edited at all.
 
Why not just bind the form anyway and set the

AllowAdditions = No
AllowEdits = No
AllowDeletions = No

and then it can't be edited at all.

Then how would I set it up to allow the user to edit the record if it needs editing/deleting or addnew record if one doest exist? I am sure it has to be done via VBA code right? Is there an example that I can follow?

I appreciate your quick response.
 
You can add a button for edits and in the click event (not property but VBA window - see here if you aren't sure what I'm talking about: http://www.btabdevelopment.com/main/QuickTutorials/Wheretoputcodeforevents/tabid/56/Default.aspx )

In the click event put:
Code:
Me.AllowEdits = True
and if you want them to be able to add records or delete you can add this;
Code:
Me.AllowAdditions = True
Me.AllowDeletions = True
And then, so it will reset when they move to another record, you will want to also add in the Form's On Current event the
Code:
With Me
   .AllowAdditions = False
   .AllowDeletions = False
   .AllowEdits = False
End With
 
You can add a button for edits and in the click event (not property but VBA window - see here if you aren't sure what I'm talking about: http://www.btabdevelopment.com/main/QuickTutorials/Wheretoputcodeforevents/tabid/56/Default.aspx )

In the click event put:
Code:
Me.AllowEdits = True
and if you want them to be able to add records or delete you can add this;
Code:
Me.AllowAdditions = True
Me.AllowDeletions = True
And then, so it will reset when they move to another record, you will want to also add in the Form's On Current event the
Code:
With Me
   .AllowAdditions = False
   .AllowDeletions = False
   .AllowEdits = False
End With

Makes perfect sense, much appreciated. Thanks. This helps a lot.
 

Users who are viewing this thread

Back
Top Bottom