using select case w/ frame to move cursor problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,

the code below's got an issue of some sort:

Private Sub Frame1_AfterUpdate()
Select Case Frame1.Value
Case 1
Me.Date_on_List.Value.SetFocus
Case 2
Me.RegisteredDate.SetFocus
Case 3
Me.TXBegunDate.Value.SetFocus
Case 4
Me.TXEndedDate.SetFocus
Case 5
Me.OffStudyDate.SetFocus
Case 6
Me.LTFUDate.SetFocus
Case 7
Me.DateDth.SetFocus
Case Else
End Select
End Sub

as you can see, i want to conditionally move the cursor to a date field. if
i don't include the 'value' part of the code in the 1st and 3rd isntances, it
won't get past the vba compiler. the code above 'compiled' but won't run.
what's going on here?

thanks for your bandwidth in advance,

ted
 
Ted said:
the code below's got an issue of some sort:

Private Sub Frame1_AfterUpdate()
Select Case Frame1.Value
Case 1
Me.Date_on_List.Value.SetFocus
Case 2
Me.RegisteredDate.SetFocus
Case 3
Me.TXBegunDate.Value.SetFocus
Case 4
Me.TXEndedDate.SetFocus
Case 5
Me.OffStudyDate.SetFocus
Case 6
Me.LTFUDate.SetFocus
Case 7
Me.DateDth.SetFocus
Case Else
End Select
End Sub

as you can see, i want to conditionally move the cursor to a date field. if
i don't include the 'value' part of the code in the 1st and 3rd isntances, it
won't get past the vba compiler. the code above 'compiled' but won't run.
what's going on here?


You're probably confused by using the word "field". A field
is a column in a table/query and can not possibly receive
the focus. You can set the focus to a "control".

Get rid of the Value part and double check that the names
you're using are the names of controls, not the names of
fields (which may or may not be the same).
 
marsh,

it works like a charm :-) beautiful, i didn't realize that there
discrepancies between the field and the form name for the control. this is a
great tip to put under my belt for future reference!

ted

ps: now if i could only resolve the semi-automatic record duplication issue
 
Back
Top