How do I get my form to automatically enter new data?

BenW

Registered User.
Local time
Today, 02:00
Joined
Jul 26, 2006
Messages
33
I currently have a form set up to type in information into text boxes that will be stored on a table. The problem is that when I open the form, it is automatically at the first row, so I have to manually go to datasheet view and scroll to the bottom of the datasheet and click on a blank row then switch back to form view in order to begin entering data. Is there a way to make it so when I open the form, it is already on the last row so I don't have to repeat this process everytime?
 
Try this in the load event:

DoCmd.GoToRecord , , acNewRec
 
Try this in the load event:

DoCmd.GoToRecord , , acNewRec

Thank you for the help, but I'm not very proficient with access to know where to type this yet. Where would I place this? I assume I'm supposed to put this on the button property that opens the form inside the event code? I tried to do a ctrl+f of 'load' and 'event' but I could not find a place in the code for the button properties.

here is my button event code if that helps:

PHP:
Option Compare Database

Private Sub exit_Click()

End Sub
Private Sub Exit1_Click()
On Error GoTo Err_Exit1_Click


    DoCmd.Quit

Exit_Exit1_Click:
    Exit Sub

Err_Exit1_Click:
    MsgBox Err.Description
    Resume Exit_Exit1_Click
    
End Sub
Private Sub Main_Click()
On Error GoTo Err_Main_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Main"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Main_Click:
    Exit Sub

Err_Main_Click:
    MsgBox Err.Description
    Resume Exit_Main_Click
    
End Sub
Private Sub Command20_Click()
On Error GoTo Err_Command20_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Data sheet"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command20_Click:
    Exit Sub

Err_Command20_Click:
    MsgBox Err.Description
    Resume Exit_Command20_Click
    
End Sub
Private Sub Command21_Click()
On Error GoTo Err_Command21_Click


    DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70

Exit_Command21_Click:
    Exit Sub

Err_Command21_Click:
    MsgBox Err.Description
    Resume Exit_Command21_Click
    
End Sub
Private Sub Command25_Click()
On Error GoTo Err_Command25_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "DataView"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command25_Click:
    Exit Sub

Err_Command25_Click:
    MsgBox Err.Description
    Resume Exit_Command25_Click
    
End Sub
Private Sub Command28_Click()
On Error GoTo Err_Command28_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "DataView"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command28_Click:
    Exit Sub

Err_Command28_Click:
    MsgBox Err.Description
    Resume Exit_Command28_Click
    
End Sub
Private Sub Command29_Click()
On Error GoTo Err_Command29_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Data sheet"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command29_Click:
    Exit Sub

Err_Command29_Click:
    MsgBox Err.Description
    Resume Exit_Command29_Click
    
End Sub
Private Sub Command30_Click()
On Error GoTo Err_Command30_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "SaleNet"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

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

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Data sheet"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command32_Click:
    Exit Sub

Err_Command32_Click:
    MsgBox Err.Description
    Resume Exit_Command32_Click
    
End Sub
Private Sub Command33_Click()
On Error GoTo Err_Command33_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Datalookup"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command33_Click:
    Exit Sub

Err_Command33_Click:
    MsgBox Err.Description
    Resume Exit_Command33_Click
    
End Sub
Private Sub Command34_Click()
On Error GoTo Err_Command34_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Datalookup"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command34_Click:
    Exit Sub

Err_Command34_Click:
    MsgBox Err.Description
    Resume Exit_Command34_Click
    
End Sub
Private Sub Command36_Click()
On Error GoTo Err_Command36_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Report Layout"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command36_Click:
    Exit Sub

Err_Command36_Click:
    MsgBox Err.Description
    Resume Exit_Command36_Click
    
End Sub
Private Sub Command37_Click()
On Error GoTo Err_Command37_Click

    Dim stDocName As String

    stDocName = "ReportData"
    DoCmd.OpenReport stDocName, acPreview

Exit_Command37_Click:
    Exit Sub

Err_Command37_Click:
    MsgBox Err.Description
    Resume Exit_Command37_Click
    
End Sub
Private Sub Command41_Click()
On Error GoTo Err_Command41_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "CNH"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command41_Click:
    Exit Sub

Err_Command41_Click:
    MsgBox Err.Description
    Resume Exit_Command41_Click
    
End Sub
Private Sub Command42_Click()
On Error GoTo Err_Command42_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "FORMData sheet"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command42_Click:
    Exit Sub

Err_Command42_Click:
    MsgBox Err.Description
    Resume Exit_Command42_Click
    
End Sub
Private Sub Command43_Click()
On Error GoTo Err_Command43_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "FORMSaleNet"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command43_Click:
    Exit Sub

Err_Command43_Click:
    MsgBox Err.Description
    Resume Exit_Command43_Click
    
End Sub
Private Sub Command44_Click()
On Error GoTo Err_Command44_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "FORMcompanyID"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command44_Click:
    Exit Sub

Err_Command44_Click:
    MsgBox Err.Description
    Resume Exit_Command44_Click
    
End Sub
Private Sub Command46_Click()
On Error GoTo Err_Command46_Click


    DoCmd.GoToRecord , , acNewRec

Exit_Command46_Click:
    Exit Sub

Err_Command46_Click:
    MsgBox Err.Description
    Resume Exit_Command46_Click
    
End Sub
Private Sub Command47_Click()
On Error GoTo Err_Command47_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "FORMCustomerBank"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command47_Click:
    Exit Sub

Err_Command47_Click:
    MsgBox Err.Description
    Resume Exit_Command47_Click
    
End Sub
Private Sub Command51_Click()
On Error GoTo Err_Command51_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "FORMDateProfit"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command51_Click:
    Exit Sub

Err_Command51_Click:
    MsgBox Err.Description
    Resume Exit_Command51_Click
    
End Sub
Private Sub Command55_Click()
On Error GoTo Err_Command55_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "FORMCusSearch"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command55_Click:
    Exit Sub

Err_Command55_Click:
    MsgBox Err.Description
    Resume Exit_Command55_Click
    
End Sub
 
No, the load event of the form being opened. That way after the form opens it will go to a new record. An alternative if you don't care about seeing existing records with that form is to change its data entry property to Yes.
 
No, the load event of the form being opened. That way after the form opens it will go to a new record. An alternative if you don't care about seeing existing records with that form is to change its data entry property to Yes.

How do I get to the load event or view the data entry property? I went to design view on the form and right clicked on the form then clicked on properties but could not find anything on data entry. Sorry for the dumb questions, but I can't find anything on this in the help file either. I am just clicking around aimlessly trying to find some sort of clue.

The version is 2007, if it helps sense the layout is completely different.
 
Thank you very much! The website you linked me to was very helpful and helped me get the job done!
 

Users who are viewing this thread

Back
Top Bottom