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!

Form properties prevents setting edit preferences -- I think?

Status
Not open for further replies.

PenelopeC

Technical User
May 12, 2003
72
US
I have this form for data entry regarding projects.

On the form I have an unbound list box that shows all records for tblPROJECTS. When the user clicks a project, the corresponding data is filled in on the rest of the form (all of those fields ARE bound.)

I also have a subform that shows project updates. Each As the user clicks project ids in the unbound list box, the main form's data is populated showing info AND the subform data is populated showing all of the updates listed (this is in a data grid control.)

My problem is this, I want to protect the records from being updated and tried putting an "UPDATE" command button on the form, but if I set this at the form level and change it with the "on click" event, my list box selection doesn't work. :(

Is there a solution to this I just can't see? Or am I stuck? All of the postings I've gone through don't approach the issue this way.

TIA
Penelope

PenelopeC
~~~>-/O~~~~~swimming right along
 
You may have to call each control individually except your button and your listbox and lock the rest of them. If you look at the controls object in help you may be able to cycle through the controls with a little more ease than typing each control name.

ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Yes, setting the form attributes at the form level can prevent you from using unbound controls to find records, etc.

My approach is to use a toggle control which has an up / down - true / false action. You can change the caption on the form to reflect the current edit status - view and edit.

I then use a sub routine on the form to set the controls per the setting of the toggle command.

Example:
cmdEditMode - Name of toogle control
rstrControl - Controls where I want to toggle the edit mode
Code:
Private Sub SetScreen()

Dim booEdit as Boolean

booEdit = Me.cmdEditMode

Me.rstrText1.Locked = booEdit
Me.rstrText3.Locked = booEdit
Me.rstrCombo4.Locked = booEdit
Me.rstrCombo6.Locked = booEdit
Me.sbfrmDetails.Locked = booEdit

End Sub

I would call this module as required
- OnCurrent event
- AfterUpdate for the toggle control, cmdEditMode

Richard
 
Thanks for the tip on checking the controls object and cycling through them on the form. I plan on trying a For...Each type of action setting them with the toggle button. I *think* I'll be able to grasp this and figure it out.

My question is for Richard...do you mean the OnCurrent Event for the form itself? And is there a way to put two toggle buttons always making one true and one false dependin.....you know what? I'm going to go search on this one!

PenelopeC
~~~>-/O~~~~~swimming right along
 
Lonnie and Richard,
Thanks for the tips....your help along with faq702-5010 has pointed me in the right direction.

YAY!

PenelopeC
~~~>-/O~~~~~swimming right along
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top