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

Trouble with setfocus on Subform

Status
Not open for further replies.

ineedahelp

Technical User
Mar 31, 2009
27
US
I keep getting an error "object doesn't support this property or method" whenever I try to set the focus to the control [DatePerformed] on my subform. NOTE: it is a new record which may be an issue... (I added the stars to highlight for purposes here)

Code:
Private Sub cmbAddTask_Click()
Dim strAnswer As String
Dim Msg, Style, Title
        
    Forms!frmTravelExpense!subfrmTravelExpense.Form.AllowAdditions = True
    Me.SetFocus
    Me.subfrmTravelExpense.SetFocus
    'Forms!frmTravelExpense!subfrmTravelExpense.Form.SetFocus
 **   DoCmd.GoToRecord , , acNewRec
    'Forms![frmTravelExpense]![subfrmTravelExpense].Form![MemberID].SetFocus
    Forms!frmTravelExpense!subfrmTravelExpense.Form![MemberID] = Me.MemberID
    Forms!frmTravelExpense!subfrmTravelExpense.Form![Description] = "Travel Expense"
 **   Forms!frmTravelExpense!subfrmTravelExpense.Form![DatePerformed].SetFocus
    Forms!frmTravelExpense!subfrmTravelExpense.Form.AllowAdditions = False

Im also having trouble with the following code which I have in my onopen event.
Code:
DoCmd.GoToRecord , , acFirst
    'Forms!frmTravelExpense!MemberID.SetFocus
    Forms!frmTravelExpense!MemberID = mMemberID
    Me.subfrmTravelExpense.Form.Filter = "[Description] = 'Travel Expense'"
    Me.subfrmTravelExpense.Form.FilterOn = True
I get errors on the setfocus line and the assignment to my field MemberID. Thank you for any help!
 
code which I have in my onopen event
Use the Load event instead.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you very much for all your suggestions. The Load event helped and my problem has been solved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top