Command button

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

Guest

I have created a command button to go to the next record on my form but I do
not know visual basic. How would I or what would I add to the expression in
the button to tell it to go to a certain field once that button is hit?
 
I have created a command button to go to the next record on my
form but I do not know visual basic. How would I or what would I
add to the expression in the button to tell it to go to a certain
field once that button is hit?

DoCmd.GoToRecord , , acNext
 
Hi Glenna

Private Sub ButtonName_Click()
DoCmd.OpenForm "FormToOpen"
Forms!FormToOpen!ControlName.SetFocus
End Sub

Change
Button Name
FormToOpen
ControlName
To what they are on your forms

Hope this helps
 
Sorry I didn't understand your question. I thought you wanted another form
not just a new record. In this case it should be

Private Sub ButtonName_Click()
DoCmd.GoToRecord , , acNewRec
[ControlName].SetFocus
End Sub

Sorry - hope this helps
 
My form has the command button on it so when the user enters a record they
can hit the button to take them to a new record but the cursor doesn't show
up anywhere. My users want it to show up in the order field. I'm not sure
the directions you gave below would do that? If so then that's great but I
just wanted to be sure I explained my situation well.
 
Hi Glenna

Private Sub ButtonName_Click()
DoCmd.GoToRecord , , acNewRec
[order].SetFocus
End Sub


Change ButtonName and [Order] (if "order" is not the name of the control -
not the table field it is bound to)

Use condidtional formating to make the background a different colour when
the field has the focus
 
Back
Top