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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a Command Button to change a record field enabled setting

Status
Not open for further replies.

sargietek

MIS
Jul 17, 2002
11
GB
Hi

I have a Project Cost Management Database System i developed in Access 97. I have a form in the systems administration section of the system where the record's fields are set to read-only when the form first opens. I did this by setting the record fields "enabled" property to No. What i would like to do is then have an "amend record" command button that sends certain fields in the record "live" ie editable, when the command button is pressed. This is because i don't want users to be able to edit the primary key or foreign key fields for obvious reasons, but they need to be able to edit, for example the decription field. I have tried using the on click event property in the command button but my level of VB Coding knowledge is not that great. Can anyone help?

Thanks.

Best regards

Sargietek.
 
You may try Locked property of the control
Code:
Private Sub cmdEnable_Click()
    Me.Text1.Locked = False
    Me.Text2.Locked = False
    Me.Text3.Locked = False
End Sub

________________________________________________________
Zameer Abdulla
Help to find Missing people
There’s a world of difference between editorials and advertorials
 
Hi Zameer

Thanks for coming back to me. As i said my VB knowledege is er "shaky" to say the least. If possible, could you be a little more specific as to where i put the code?

Thanks

Sargietek.
 
The code is to behind the commanbutton's click event.
I mean "amend record" button's click event.

________________________________________________________
Zameer Abdulla
Help to find Missing people
There’s a world of difference between editorials and advertorials
 
Thank - you Zameer, that worked a treat. Much appreciated.

Can you recommend a book with these kind of things in? I tried all manner of sites to find how to do this, fairly mundane task, before posting this thread. My problem is i know what i want to do but don't know how to phrase it in a syntax that either help files or search engines seem to understand.

Thanks again.

Best regards.

Sargietek.
 
I have never read a complete book in the advanced level. All my MS Access knowledge from Tek-tips and sample downloads from the net. I have listed a lot of them im my site; some might help you.

BTW, most of the gurus recommend "Access Developer's Hanbook, Sybex" (Acc97 or 2000 or what you prefer).


________________________________________________________
Zameer Abdulla
Help to find Missing people
There’s a world of difference between editorials and advertorials
 
Hi Zameer

Can you give me some advice? In the same form we have been talking about, i want to filter the records using a command button on a form. I can't use the filter by selection button on the toolbar because i have deliberately made the toolbars hidden at system start up because it is a multi-user system & i only want the user to use command buttons that i give them. Basically, i have a list of about 100 users in there all displayed on the form. What i would like to do is have a command button marked "A" & when clicked it only shows the User names on the form that start with "A" thus eliminating the need for a user to scroll through 100 records. I can do it using a query & then basing the form on the Query but obviously i want to try to avoid writing 27 seperate queries (1 for each letter of the alphabet & 1 for "ALL")so i was wondering if i could do it through VBA code behind each button & then just change the search letter behind the button. Can you advise?

Thanks again

Sargietek.
 
If you have Northwind database that shipped with MS Access then open its "Customer Phone list" form to see how it works. It works with macro. If you are working on Access2000 or higher then you can convert the macro to code.

Sample Northwind can be accessed from the help menu of Access.

Convert Macro is from TOOLS > MACRO > CONVERT...


________________________________________________________
Zameer Abdulla
Help to find Missing people
There’s a world of difference between editorials and advertorials
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top