Command Button ?

T

Tom

When I click on my command button, this is
the code that is run.

Private Sub Command85_Click()
DoCmd.GoToRecord , , acNewRec
Me.RunNumber = Nz(DMax("[RunNumber]", "ABLE_Table1", "[RunDate]=Date()"), 0)
+ 1
Me.Dirty = False
End Sub

After I click, the next record comes up ready for input, however,
the command button is still highlighted.

I need it to tab stop on the first control of that next record

Tom
 
T

Tom

Klatuu,

Got a compile error:

"Method or data member not found"

the highlighted text is ".MyFirstControl"
I'm assuming I replace "MyFirstControl" with the
name of the field that I should see the Cursor flashing, in this case
"CallTime".
However, when I do that, it gives me the same message.

"Method or data member not found"

the highlighted text is ".CallTime"

p.s. the tab stop on "CallTime" is set to "0"

Tom




Klatuu said:
Just set the focus to the control you want. See addition to code below:

Tom said:
When I click on my command button, this is
the code that is run.

Private Sub Command85_Click()
DoCmd.GoToRecord , , acNewRec
Me.RunNumber = Nz(DMax("[RunNumber]", "ABLE_Table1", "[RunDate]=Date()"), 0)
+ 1
Me.Dirty = False Me.MyFirstControl.SetFocus
End Sub

After I click, the next record comes up ready for input, however,
the command button is still highlighted.

I need it to tab stop on the first control of that next record

Tom
 
K

Klatuu

What the tab stop says doesn't matter. As long as the control is enabled it
should be able to receive the focus. Assuming the control is on the current
form, the syntax should be:

Me.CallTime.SetFocus

Tom said:
Klatuu,

Got a compile error:

"Method or data member not found"

the highlighted text is ".MyFirstControl"
I'm assuming I replace "MyFirstControl" with the
name of the field that I should see the Cursor flashing, in this case
"CallTime".
However, when I do that, it gives me the same message.

"Method or data member not found"

the highlighted text is ".CallTime"

p.s. the tab stop on "CallTime" is set to "0"

Tom




Klatuu said:
Just set the focus to the control you want. See addition to code below:

Tom said:
When I click on my command button, this is
the code that is run.

Private Sub Command85_Click()
DoCmd.GoToRecord , , acNewRec
Me.RunNumber = Nz(DMax("[RunNumber]", "ABLE_Table1", "[RunDate]=Date()"), 0)
+ 1
Me.Dirty = False Me.MyFirstControl.SetFocus
End Sub

After I click, the next record comes up ready for input, however,
the command button is still highlighted.

I need it to tab stop on the first control of that next record

Tom
 

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