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!

On Key Press Code Problem

Status
Not open for further replies.

Howiee

MIS
Jan 28, 2001
9
NZ
Hello,
I have a subform called subStoreOrder and a main form called StoreOrder. In the sub form I have the following code that runs on the On Key Press Event.

Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 17 Then
Forms![StoreOrder].SetFocus
currentstore = cmbStore.Value
cmbStore.Value = currentstore + 1
Else
End If
End Sub

What I am trying to do is when Ctrl + q is pressed it runs the code. The code is suppose to first set the focus to the main form (Store Order), then work out the value of cmbStore (cmbStore is a combo box on the main form. It contains a numeric ID for each store) and then go to the next ID in cmbStore. However I get the following error.

Runtime error '424'
Object Required.

Can anybody please help?

 
Instead of using "Forms![StoreOrder].SetFocus", try using

"Parent![StoreOrder].SetFocus"

HTH
Lightning
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top