Crystal,
I might give this a try on a test database of course until I get it to work. I will not need the password I just need to stop those stupid mistakes.
thanks,
Bill
--- In MS_Access_Professionals@yahoogroups.com, Crystal <strive4peace2008@...> wrote:
>
> Hi Bill,
>
> > "Despite ongoing training the users periodically by pass the Lookup Combo box and go to the last name field of the form and type in the name they are searching for. "
>
> on the BeforeUpdate event of this control, do this:
>
> if msgbox("You are attempting to change the name on this record from " & me.activecontrol.oldvalue _
> & " to " & me.activecotrol.value _
> & vbcrlf & vbcrlf & "Do you want to FIND this record instead?" _
> , vbyesno, "FIND record instead of change?") = vbyes then
> Me.Undo
> Cancel = true
> ' hook in to your FIND code
> end if
>
> you can also require a password to change the name ... I have a popup password picker but not sure if it is posted
>
> When I use combos for purposes of showing data, I cover the drop-down arrow with a rectangle that is the same color as the section background.
>
> ~~~
>
> I rarely set the form Edit property to No. Here is some code you can put into a standard module to loop through all controls in the detail section and lock or unlock them depending on whether you pass True or False.
>
> Lock controls:
>
> on the property sheet of a control on the form:
> =LockUnlockDetailControlsTag( [form],true,"Data",[cboFind])
>
> in code:
> LockUnlockDetailControlsTag Me,true,"Data",Me.cboFind
>
> to unlock controls, send False
>
> then put this in the TAG property of each control to flip:
>
> ~Data~
>
> I use tilede's around terms and do an instr match so that other tags can be there too.
>
> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Function LockUnlockDetailControlsTag( _
> pForm As form_
> , pBoo As Boolean _
> , pTag As String _
> , pControlFocus As control _
> ) as byte
> 'Crystal 1/7/2008
>
> Dim ctl As Control
>
> 'if we are locking controls then move focus
> if pBoo then pControlFocus.SetFocus
>
> On Error goto Proc_Err
>
> 'this is limited to controls in the detail section
> For Each ctl In pForm.Detail.Controls
>
> If InStr(ctl.Tag, pTag) > 0 Then
>
> ctl.Locked = pBoo
> ctl.Enabled = not pBoo
>
> End If
>
> Next ctl
>
> Proc_Exit:
>
> If Not ctl Is Nothing Then Set ctl = Nothing
> Exit Function
>
> Proc_Err:
> MsgBox Err.Description, , _
> "ERROR " & Err.Number _
> & " LockUnlockDetailControlsTag"
>
> Resume Proc_Exit
>
> 'if you want to single-step code to find error, CTRL-Break at MsgBox
> 'then set this to be the next statement
> Stop: Resume
>
> End Function
>
> '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> and if you want it to act on controls in a subform, pass this:
>
> in property
> [form].[subform_controlname].form, "Data",True,[form].[subform_controlname].form.cboFind
>
> in code:
> Me.subform_controlname.form, "Data",True,Me.subform_controlname.form.cboFind
>
> substitute the name of a 'safe' control on your form for cboFind
>
> Warm Regards,
> Crystal
>
> Microsoft MVP, Access
> remote training and programming
>
> free book, tips, and tools:
> http://www.AccessMVP.com/strive4peace
>
> free video tutorials:
> http://www.YouTube.com/LearnAccessByCrystal
> http://www.YouTube.com/LearnByCrystal
>
> free downloads:
> http://www.rogersaccesslibrary.com/forum/long-crystal_forum71.htm
>
> *
> (: have an awesome day :)
> *
>
>
>
>
>
>
> ________________________________
> From: Duane Hookom <duanehookom@...>
> To: Access Professionals Yahoo Group <ms_access_professionals@yahoogroups.com>
> Sent: Sunday, November 4, 2012 10:03 PM
> Subject: RE: [MS_AccessPros] Open on Blank Record
>
> You decide what you think is appropriate. I would selectively lock and/or disable controls if the users can't leave the values alone.
>
> Duane Hookom MVP
> MS Access
>
> > To: MS_Access_Professionals@yahoogroups.com
> > From: Bill.Singer@...
> > Date: Mon, 5 Nov 2012 04:03:36 +0000
> > Subject: Re: [MS_AccessPros] Open on Blank Record
> >
> >
> > Duane,
> > So in the "ON OPEN" event I could set the edit property to NO.
> >
> > I did not see a LOCKED property.
> >
> > When the EDIT property is set to NO my combo box does not work either.
> >
> > Or.. should I set the LOCKED property of the last name field to YES on OPEN and then unlock it at the exit of the combo box?
> >
> > I am thinking out loud but am I on the right track?
> >
> > Thanks,
> > Bill
> >
> >
> >
> > -----Original Message-----
> > From: Duane Hookom [mailto:duanehookom@...]
> > Sent: Sunday, November 4, 2012 09:10 PM
> > To: 'Access Professionals Yahoo Group'
> > Subject: RE: [MS_AccessPros] Open on Blank Record
> >
> > You can default the form to locked and then unlock the controls based on some event.
> >
> > Duane Hookom MVP
> > MS Access
> >
> > > To: mailto:MS_Access_Professionals%40yahoogroups.com
> > > From: mailto:Bill.Singer%40at-group.net
> > > Date: Mon, 5 Nov 2012 01:52:47 +0000
> > > Subject: [MS_AccessPros] Open on Blank Record
> > >
> > > I have a client Lookup up combo box on a form which contains the client information including last name and first name.
> > >
> > > Despite ongoing training the users periodically by pass the Lookup Combo box and go to the last name field of the form and type in the name they are searching for. This changes the data on the first record that shows up on the form when the form is open.
> > >
> > > Is it possible to open a form to a blank record without it being a New record?
> > >
> > > Any other ideas on how to prevent the first record from this user error?
> > >
> > > Thank you,
> > > Bill
> > > MN
> > >
> > >
> > >
> > > ------------------------------------
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
> [Non-text portions of this message have been removed]
>
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (6) |
Tidak ada komentar:
Posting Komentar