Results 1 to 2 of 2
  1. #1
    alex_raju is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    56

    Question how to control tab ?

    hi,

    i have a main form (mf) and a subform (sf)
    how i can send tab key to main form cmdbutton from subform, while subform text control(productid) value "r" at the same time i am using below code in afterupdate option

    Private Sub ProductID_AfterUpdate()
    On Error GoTo Err_ProductID_AfterUpdate

    Dim strfilter As String

    strfilter = "productID=" & Me!ProductID

    Me!UnitPrice = DLookup("UnitPrice", "Products", strfilter)

    Me.ProductID.SetFocus

    Exit_ProductID_Afterupdate:
    Exit Sub

    Err_ProductID_AfterUpdate:
    If Me.ProductID.Value <> DLookup("ProductId", "Products") Then
    MsgBox "wrong no"


    SendKeys "{home}"
    Undo
    Else
    End If
    End Sub

    thank you
    alex

  2. #2
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209
    Add the following in the Code:

    Me.Parent.cmdbutton.SetFocus

    Code:
    Private Sub ProductID_AfterUpdate()
    On Error GoTo Err_ProductID_AfterUpdate
    
    Dim strfilter As String
    
    strfilter = "productID=" & Me!ProductID
    
    Me!UnitPrice = DLookup("UnitPrice", "Products", strfilter)
    
    Me.ProductID.SetFocus
    
    Me.Parent.cmdbutton.SetFocus
    
    Exit_ProductID_Afterupdate:
    Exit Sub
    
    Err_ProductID_AfterUpdate:
    If Me.ProductID.Value <> DLookup("ProductId", "Products") Then
    MsgBox "wrong no"
    SendKeys "{home}"
    Undo
    Else
    End If
    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Help with tab control please
    By cdzajp in forum Forms
    Replies: 2
    Last Post: 07-14-2011, 02:38 PM
  2. Replies: 1
    Last Post: 05-18-2011, 07:23 AM
  3. Replies: 6
    Last Post: 03-14-2011, 09:37 AM
  4. Tab Control example
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-30-2010, 09:04 PM
  5. Sending control to specific control
    By wasim_sono in forum Programming
    Replies: 2
    Last Post: 04-19-2007, 08:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums