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

Help using "YES/NO" command button

Status
Not open for further replies.

MarkRCC

IS-IT--Management
Apr 26, 2001
167
CA
Hi.

I have a form with a subform. The main form allows an employee lookup. The user selects an employee name from a combobox which then displays that employee's info (address, phone, etc). If the employee chosen is correct, the user presses the <TAB> key and the focus moves to the subfom allowing the user to use another combo box to select a company name that that particular employee had sales for. Once a company is selected, the focus moves to another field on the subform where the user has to enter commission info. There are then two unbound calculated text boxes that automatically displays commission information based on the company selected. This all works great except for one thing:

Once the commission info has been entered and the user clicks the <TAB> button, the two calculated controls do their thing but the focus moves immediately to a new record and, of course, clears the subform screen. This occurs so quickly that the user cannot verify that the commission info calculated is correct. I decided that a &quot;Y/N&quot; command button would suffice with the default set to &quot;YES&quot; and a label asking the user if the calculations are correct. If the user selects &quot;YES&quot; then a new record opens on the subform. If &quot;NO&quot;, then the focus moves back to the &quot;Commission&quot; field where the user can re-enter different commission data. Can someone give me a hint on how to do this?

Sorry for being so &quot;wordy&quot;!

Many TIAs for any help and/or suggestions.

Mark
 
You can use an If...Then on the Yes/No button.

Response = MsgBox(&quot;Is this correct?&quot;, vbYesNo)

If Response = 6 Then

'Open Form
Else
docmd.GoToControl(&quot;Name of Control&quot;)
End if

The 6 is the returned result for the Yes button click.

The above option uses a message box for the yes/no instead of a command button. This message box can be put in the AfterUpdate of the field where the user hits the TAB button.

Hope that helps.




DreamerZ
simplesolutions@prodigy.net
[ignore][/ignore]
 
You could also set the &quot;Cycle&quot; records to &quot;Current Record&quot; (on the &quot;Other&quot; tab in &quot;Properties&quot;). Then that record will not loose the focus until the user clicks on a new record.
 
Ok. This is how I did it.

The user won't ever have to input any data into this calculated control so I set it's &quot;Locked&quot; property to Yes and it's tab stop to Yes. Now the person enters the commisson rate, hit's the <TAB> key and the focus goes to the calc control box and a message pops up telling the user to either hit <TAB> for a new record or backspace back to the input control. Works great!

Many thanks for your suggestions!

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top