Command button

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?
 
B

Bob Quintal

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
 
G

Guest

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
 
G

Guest

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
 
G

Guest

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top