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

SetFocus on Subform

Status
Not open for further replies.

perrymans

IS-IT--Management
Nov 27, 2001
1,340
US
I know this is simple, but I can't get my syntax right.

I have a combo and the afterupdate checks for a value "New Project" and opens a form if it returns true.

I want to add an Else statment afterwards that will set the focus to the field WorkOrder on my subform. The combo is on the main form.

Thanks. Sean.
 
I tried this:

Sub Combo12_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[ProjectID] = '" & Me![Combo12] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark

If Me.Combo12 = "New Project" Then
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNewProject"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Else: Me!frmProjectSubform.Form![WorkOrder].SetFocus
End If

End Sub

I think I should mention that the subform is a continuous form, which I assume would make a difference. But this bit above did not work.

Thanks. Sean.
 
Yeah it is. I don't actually need it there since it opens a Data Entry form, but thanks for pointing it out. I've gone in and deleted the un-needed.

Sean.
 
If you e-mail me your zipped DB, maybe it will be easier to sort this and your other Thread181-449697 and Thread181-449675 out. Will post results in threads.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top