Command button help

dgmorr

Registered User.
Local time
Today, 17:18
Joined
Jan 10, 2007
Messages
71
Hey guys,

I haev a form from which I have users input data. I would like to have a button when a record is complete and does not need to have any more work done to it. I don't really know where to start. I have a field in the table that signifies whether or not the record is complete. I just don't know how to make the button work with the specific record, for example record number 235. Can anyone offer me some direction? Thanks.

Would I do something along the lines of

OnClick()

Table1.Record_Complete.CurrentRecord() = "Y"

Is there something like CurrentRecord or a similar function?
 
Last edited:
1. Add a field in your table (Yes/No) for Completed

2. Within your form, just make sure that is in your recordset.

3. Use this code in the Click event of the button:
Code:
    Me!YourYesNoField = True
    Me.YourButtonNameHere.Enabled = False

4. In the On Current event of the form put:
Code:
   If Me!YourYesNoField = True Then
       Me.YourButtonNameHere.Enabled = False
   Else
       Me.YourButtonNameHere.Enabled = True
   End If
 
Thanks Bob! I just came across the Me! in another thread, but the last part is what I also need.

Is there anyway I can have a pop up when the button is pressed as a double confirmation that would execute the function if the Yes button is pressed in the pop up box?
 
Thanks Bob! I just came across the Me! in another thread, but the last part is what I also need.

Is there anyway I can have a pop up when the button is pressed as a double confirmation that would execute the function if the Yes button is pressed in the pop up box?

All you would need is to modify the command button code to this:

Code:
If MsgBox("Are you SURE you want to mark this as complete?", vbYesNo + vbQuestion, "Completion Confirmation") = vbYes Then
    Me!YourYesNoField = True
    Me.YourButtonNameHere.Enabled = False
End If
 
Thanks again Bob!

The only problem I am having is with

Me.YourButtonNameHere.Enabled = False

It won't allow that while the object has the focus. How do I get around this?
 
Sorry, just use

Me.SomeOtherControl.SetFocus

replacing SomeOtherControl with the name of another control that is enabled and put that code just prior to the line causing the problem.
 

Users who are viewing this thread

Back
Top Bottom