View Full Version : Moving focus to another control


klwu
12-05-2005, 05:10 PM
Hi, I am stuck at a point where I want to set the focus to another control when a control has been clicked.

e.g. I have a command button (cmdAccept), when this button has been clicked, I want to disable this control, and move the focus to a combo box (cmbStockCode). How should I achieve this? I have tried to put in codes in the event procedure of cmdAccept.OnClick event, but I get a error saying that "Microsoft Access cannot move the focus to cmbStockCode."

here is my code

Private Sub cmdAccept_Click()
On Error GoTo Exit_cmdAccept_Click

Me!cmbStockCode.SetFocus
Me!cmdAccept.Enabled = False

Exit_cmdAccept_Click:
Exit Sub

Err_cmdAccept_Click:
MsgBox Err.Description
Resume Exit_cmdAccept_Click


Could someone help me on this? Thanks in advance.

klwu
12-05-2005, 05:32 PM
Never mind, I have solved the problem...I forgot to set the cmbStockCode to enable....:o