So, your Form_Current event proc is already doing something (i.e.
calling the Sub named "subShowvalues")
No matter - you want it to also do something else, so add your line of
code after that one.
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
Graham this is what is in there:
Private Sub Form_Current()
subShowValues
End Sub
Hi Bob
With the form open in design view and the properties window displayed
(View>Properties), select the form (click the grey square in the top
left, or use Ctrl-R). Now, in the properties window, on the Event
tab, scroll down until you see "On Current". Type a
left-square-bracket "[" in the cell and "[Event Procedure]" should
appear. Then click the three dots button to the right of the cell.
The VBA code window should open showing (among other things):
Private Sub Form_Current()
| <<< cursor is here
End Sub
This is the event procedure for your form's Current event. That's
where the code goes.
What I meant about a boolean field was to have a yes/no field in your
table named "Finished". You can then bind this to a checkbox on your
form and a single click will put a tick in the box (Finished) or clear
it (Active).
Your code below would then change to:
cbOwnerID.Locked = Me.Finished
BTW, I know horses are pretty important in your neck of the woods, but
they have clients???
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
Could not find this:
AND
in the Current event for your form, add the following code:
Thanx..Bob
No Graham just has the two (Active,Finished), should this be done
another way?.....Regards Bob Vance
Hi Bob
Sorry, I've been away for a few days.
Yes, this is certainly possible. In the AfterUpdate event for
cbStatus, AND in the Current event for your form, add the following
code:
cbOwnerID.Locked = (cbStatus = "Finished")
Does Status have any options other than "Active" and "Finished"?
If not, you might consider making it a boolean (yes/no) field bound
to a checkbox. This would save real estate on your form and would
probably make the user interface more intuitive.
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand - Torbay
Graham I have a form that has a combo Box that has 2 options
(Active & Finished)cbStatus, and another combo box that list
clients, is possible to lock The clients Combo Box cbOwnerID when
it is in active mode and unlock when in finished mode
Thanks Bob (Papakura)
Thanx Graham got it now!
Hi Bob (fellow Kiwi?
The default MsgBox has only one button - "OK". If you want to
give the user a choice you need at least two buttons.
The second argument for MsgBox allows you to specify options
such as the buttons to show and the icon to display.
For example, you could say:
If MsgBox("Does this horse have a Client", vbYesNo + vbQuestion)
= vbYes Then
This will display Yes and No buttons and a question mark icon.
The function will return the value vbYes only if the "Yes"
button was clicked.
As well as vbYesNo, you can use vbOKCancel, vbYesNoCancel, or
vbAbortRetryCancel (the latter two have three buttons).
Also, it is not incorrect, but it is most unusual to enclose
your entire procedure body in an If...EndIf block.
You should change this to:
On Error ...
If MsgBox ... Then
DoCmd.GoToRecord , , acNewRec
End If
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
After the MsgBox line I must be missing something for it to
work, and can I change "Yes" to "Ok"
Private Sub Command98_Click()
If MsgBox("Does this horse have a Client") = vbYes Then
On Error GoTo Err_Command98_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command98_Click:
Exit Sub
Err_Command98_Click:
MsgBox Err.Description
Resume Exit_Command98_Click
End If
End Sub
Thanks in advance.........Bob Vance