Access forms "add record"

  • Thread starter Thread starter Abdulhay
  • Start date Start date
A

Abdulhay

uyrtyutuiktyokylioyloi
Ofer said:
There command32, mybe this button used to add a new record.
After the line that used to add a new record, add the line to set the focus
to the field
And I would recomand changing the field name Date, its a reserved name in
access, and it can cause some problem


Private Sub Command32_Click()
On Error GoTo Err_Command32_Click


DoCmd.GoToRecord , , acNewRec
Me.[Date].SetFocus

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub

--
\\// Live Long and Prosper \\//
BS"D


manuwai99 said:
Thanks Ofer.
Date field is first in Tab Order.
Not quite sure where to put the code you suggest. I designed the form using
the wizard. Presently the code reads as follows:
Option Compare Database 'Use database order for string comparisons

Private Sub cmdIncomeTransaction_Click()
On Error GoTo Err_cmdIncomeTransaction_Click


DoCmd.GoToRecord , , A_NEWREC
Forms![Income Transaction]![Date].SetFocus
Exit_cmdIncomeTransaction_Click:
Exit Sub

Err_cmdIncomeTransaction_Click:
MsgBox Error$

Resume Exit_cmdIncomeTransaction_Click

End Sub

Private Sub cmdIncomeType_Click()
On Error GoTo Err_cmdIncomeType_Click

Dim DocName As String
Dim LinkCriteria As String

DocName = "Income Type"
DoCmd.OpenForm DocName, , , LinkCriteria

Exit_cmdIncomeType_Click:
Exit Sub

Err_cmdIncomeType_Click:
MsgBox Error$
Resume Exit_cmdIncomeType_Click

End Sub

Private Sub Command30_Click()
On Error GoTo Err_Command30_Click


DoCmd.GoToRecord , , acNext

Exit_Command30_Click:
Exit Sub

Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click

End Sub
Private Sub Command32_Click()
On Error GoTo Err_Command32_Click


DoCmd.GoToRecord , , acNewRec

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub

Private Sub Command32_Enter()

End Sub

Thanks Manuwai99

Ofer said:
Either set the TabOrder of the fields so this date field will be the first
(While the form in design view, select in the manu bar, view > Tab Order)

Or, In the OnLoad event of the form add the code
Me.[Date Field Name].SetFocus

--
\\// Live Long and Prosper \\//
BS"D


:

I have an Access database with a formwhere I enter a new record however when
I click on the Add Record command button a new form pops up but the cursor is
nowhere to be seen. I want the cursor to automatically flash in the "date"
field but presently have to do this with the mouse. I suspect it has
something to do with "set focus" but I can't sem to find the solution. Can
someone please help.
 
I have an Access database with a formwhere I enter a new record however when
I click on the Add Record command button a new form pops up but the cursor is
nowhere to be seen. I want the cursor to automatically flash in the "date"
field but presently have to do this with the mouse. I suspect it has
something to do with "set focus" but I can't sem to find the solution. Can
someone please help.
 
Either set the TabOrder of the fields so this date field will be the first
(While the form in design view, select in the manu bar, view > Tab Order)

Or, In the OnLoad event of the form add the code
Me.[Date Field Name].SetFocus
 
Thanks Ofer.
Date field is first in Tab Order.
Not quite sure where to put the code you suggest. I designed the form using
the wizard. Presently the code reads as follows:
Option Compare Database 'Use database order for string comparisons

Private Sub cmdIncomeTransaction_Click()
On Error GoTo Err_cmdIncomeTransaction_Click


DoCmd.GoToRecord , , A_NEWREC
Forms![Income Transaction]![Date].SetFocus
Exit_cmdIncomeTransaction_Click:
Exit Sub

Err_cmdIncomeTransaction_Click:
MsgBox Error$

Resume Exit_cmdIncomeTransaction_Click

End Sub

Private Sub cmdIncomeType_Click()
On Error GoTo Err_cmdIncomeType_Click

Dim DocName As String
Dim LinkCriteria As String

DocName = "Income Type"
DoCmd.OpenForm DocName, , , LinkCriteria

Exit_cmdIncomeType_Click:
Exit Sub

Err_cmdIncomeType_Click:
MsgBox Error$
Resume Exit_cmdIncomeType_Click

End Sub

Private Sub Command30_Click()
On Error GoTo Err_Command30_Click


DoCmd.GoToRecord , , acNext

Exit_Command30_Click:
Exit Sub

Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click

End Sub
Private Sub Command32_Click()
On Error GoTo Err_Command32_Click


DoCmd.GoToRecord , , acNewRec

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub

Private Sub Command32_Enter()

End Sub

Thanks Manuwai99

Ofer said:
Either set the TabOrder of the fields so this date field will be the first
(While the form in design view, select in the manu bar, view > Tab Order)

Or, In the OnLoad event of the form add the code
Me.[Date Field Name].SetFocus

--
\\// Live Long and Prosper \\//
BS"D


manuwai99 said:
I have an Access database with a formwhere I enter a new record however when
I click on the Add Record command button a new form pops up but the cursor is
nowhere to be seen. I want the cursor to automatically flash in the "date"
field but presently have to do this with the mouse. I suspect it has
something to do with "set focus" but I can't sem to find the solution. Can
someone please help.
 
There command32, mybe this button used to add a new record.
After the line that used to add a new record, add the line to set the focus
to the field
And I would recomand changing the field name Date, its a reserved name in
access, and it can cause some problem


Private Sub Command32_Click()
On Error GoTo Err_Command32_Click


DoCmd.GoToRecord , , acNewRec
Me.[Date].SetFocus

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub

--
\\// Live Long and Prosper \\//
BS"D


manuwai99 said:
Thanks Ofer.
Date field is first in Tab Order.
Not quite sure where to put the code you suggest. I designed the form using
the wizard. Presently the code reads as follows:
Option Compare Database 'Use database order for string comparisons

Private Sub cmdIncomeTransaction_Click()
On Error GoTo Err_cmdIncomeTransaction_Click


DoCmd.GoToRecord , , A_NEWREC
Forms![Income Transaction]![Date].SetFocus
Exit_cmdIncomeTransaction_Click:
Exit Sub

Err_cmdIncomeTransaction_Click:
MsgBox Error$

Resume Exit_cmdIncomeTransaction_Click

End Sub

Private Sub cmdIncomeType_Click()
On Error GoTo Err_cmdIncomeType_Click

Dim DocName As String
Dim LinkCriteria As String

DocName = "Income Type"
DoCmd.OpenForm DocName, , , LinkCriteria

Exit_cmdIncomeType_Click:
Exit Sub

Err_cmdIncomeType_Click:
MsgBox Error$
Resume Exit_cmdIncomeType_Click

End Sub

Private Sub Command30_Click()
On Error GoTo Err_Command30_Click


DoCmd.GoToRecord , , acNext

Exit_Command30_Click:
Exit Sub

Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click

End Sub
Private Sub Command32_Click()
On Error GoTo Err_Command32_Click


DoCmd.GoToRecord , , acNewRec

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub

Private Sub Command32_Enter()

End Sub

Thanks Manuwai99

Ofer said:
Either set the TabOrder of the fields so this date field will be the first
(While the form in design view, select in the manu bar, view > Tab Order)

Or, In the OnLoad event of the form add the code
Me.[Date Field Name].SetFocus

--
\\// Live Long and Prosper \\//
BS"D


manuwai99 said:
I have an Access database with a formwhere I enter a new record however when
I click on the Add Record command button a new form pops up but the cursor is
nowhere to be seen. I want the cursor to automatically flash in the "date"
field but presently have to do this with the mouse. I suspect it has
something to do with "set focus" but I can't sem to find the solution. Can
someone please help.
 
Thank you,

Unfortunately that didn't make any difference. Problem remains. Any furhter
suggestions?

Manuwai99

Ofer said:
There command32, mybe this button used to add a new record.
After the line that used to add a new record, add the line to set the focus
to the field
And I would recomand changing the field name Date, its a reserved name in
access, and it can cause some problem


Private Sub Command32_Click()
On Error GoTo Err_Command32_Click


DoCmd.GoToRecord , , acNewRec
Me.[Date].SetFocus

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub

--
\\// Live Long and Prosper \\//
BS"D


manuwai99 said:
Thanks Ofer.
Date field is first in Tab Order.
Not quite sure where to put the code you suggest. I designed the form using
the wizard. Presently the code reads as follows:
Option Compare Database 'Use database order for string comparisons

Private Sub cmdIncomeTransaction_Click()
On Error GoTo Err_cmdIncomeTransaction_Click


DoCmd.GoToRecord , , A_NEWREC
Forms![Income Transaction]![Date].SetFocus
Exit_cmdIncomeTransaction_Click:
Exit Sub

Err_cmdIncomeTransaction_Click:
MsgBox Error$

Resume Exit_cmdIncomeTransaction_Click

End Sub

Private Sub cmdIncomeType_Click()
On Error GoTo Err_cmdIncomeType_Click

Dim DocName As String
Dim LinkCriteria As String

DocName = "Income Type"
DoCmd.OpenForm DocName, , , LinkCriteria

Exit_cmdIncomeType_Click:
Exit Sub

Err_cmdIncomeType_Click:
MsgBox Error$
Resume Exit_cmdIncomeType_Click

End Sub

Private Sub Command30_Click()
On Error GoTo Err_Command30_Click


DoCmd.GoToRecord , , acNext

Exit_Command30_Click:
Exit Sub

Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click

End Sub
Private Sub Command32_Click()
On Error GoTo Err_Command32_Click


DoCmd.GoToRecord , , acNewRec

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub

Private Sub Command32_Enter()

End Sub

Thanks Manuwai99

Ofer said:
Either set the TabOrder of the fields so this date field will be the first
(While the form in design view, select in the manu bar, view > Tab Order)

Or, In the OnLoad event of the form add the code
Me.[Date Field Name].SetFocus

--
\\// Live Long and Prosper \\//
BS"D


:

I have an Access database with a formwhere I enter a new record however when
I click on the Add Record command button a new form pops up but the cursor is
nowhere to be seen. I want the cursor to automatically flash in the "date"
field but presently have to do this with the mouse. I suspect it has
something to do with "set focus" but I can't sem to find the solution. Can
someone please help.
 
Back
Top