Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Correct method to open form for new record

Status
Not open for further replies.

DevelopV

Technical User
Mar 16, 2012
113
ZA
I run an Access 2010 database over a network.
One form, based on a table with 30,000 records, is always opened to display a new record using:
Code:
DoCmd.OpenForm "myFormName"
DoCmd.GoToRecord , , acNewRec
would it be quicker/more efficient to open the form like this:
Code:
Private Sub Form_Open(Cancel As Integer)
Me.RecordSource = "SELECT * From tblCustomerQuotation WHERE 1=0"
End Sub
My thinking is that by using "WHERE 1=0" no records will be brought over form the back-end database, resulting is a speedier form load.
Is my thinking correct?
Thanks in advance
 
Normally this is done in openform method by setting the datamode to acadd vice acedit. What do you want to happen after they enter the new record? You would have to either close the form or have a button to switch to edit mode.
 
What do you want to happen after they enter the new record?

There is a button on the form that opens a pop up form from which they can select records
I then change the record source to: Me.RecordSource = "SELECT * From tblCustomerQuotation WHERE CustomerQuotationId = " & lngCustomerQuotationId
Users can edit the records

I need to keep the transfer of data between the back end and the front end to a minimum!
 
So yes this is bad
Code:
DoCmd.OpenForm "myFormName"
DoCmd.GoToRecord , , acNewRec

This would return all the records and then send you to a new record

What i do not know if when you set the datamode to acadd does that do the same as having a query that returns no record, or does it return all records and then filter them out. I assume it is the first. If so that is equivalent to setting the recordsource to a query that returns no records. So either use acadd or set the query to return no records.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top