Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving a Record, but Locking it out.. ? 1

Status
Not open for further replies.

JesseL

IS-IT--Management
Jul 29, 2002
59
US
Hello! I would like a command button called "Omit". This is for the user to click if that record should be omitted, but saved into the table. And those records that are "omitted", will not be able to change in the future.

thanks to all who help :)
ksharp
 
put a yes/no Omit field with your records ... and in the forms you'll be editing the data, look at the value of Omit to enable/diable Edit boxes
 
Thanks for your response Rsi2, but this is a bit foggy to me: "and in the forms you'll be editing the data, look at the value of Omit to enable/diable Edit boxes"? Im not sure what you mean. Can you elaborate just a little please?

thanks
ksharp
 
make a form for editing your data (using your table as a source)
for the field you want to protect put this code on the "OnChange Event"

Private Sub text_Change() 'for the field named "text"
If omit Then
text.Undo
End If
End Sub


Result : if u try to modify the field, anything you do it will be UNDOed if omit is checked
 
Thanks again rsi2. I would like the whole Record to be locked though. So instead of writing code for each control, what would be the correct code to use for the whole record? i have combo boxes and text boxes on my edit form. Would i put this in the form_onchange event, or the close command button?

Thanks
ksharp
 
a faster way not to show the records you don't want to modify.
Put :
SELECT Table2.text, Table2.omit FROM Table2 WHERE ((Not (Table2.omit)));

as the source of your form.
However I prefer the 1st method ... you can see, but you don't touch :)))
 
Does this SQL code go into the one of the form properties?, if so, where? Sorry rsi2, im new to coding. What is the source of the form?

thanks
ksharp
 
I'm using frech version of Access now, so sorry if i'm messing up with names.

In the form that you create you are asked what is the source ... u can put a table or a query or SQL statement ... it's cleaner to create a query with the SQL statement that u want and use it as the source.
For a form that already exists, open it in design mode right click on the top-left little black-box and choose properties. On the Data tab the 1st thing is the source of the form (from where the data is extracted)
 
Thank you RSi2! everything is copasetic now :)
Now I have a better understanding.. thx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top