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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default to first record in table when form is opened.

Status
Not open for further replies.

lmarles

Technical User
Dec 8, 2000
25
0
0
CA
Using Access97, I want to set up a form that will default to the first record in a table when the form is first opened. I have a table 'Employees' and a form 'Employee Info'. The form has controls bound to 'Last_Name' and 'First_Name' in the 'Employees' table. When I open the form I want the data from the first record in the table to appear in the control boxes. How do I do this?

Lou Marles
 
Since you say you have the first name and last name bound then I think you are asking for something else.

In a relational database such as Access, which ever field is sorted is how the records show up. See Access doesn’t keep track of records by a “record number”.
So if you want Amber Smith first before Brittany Spears then sort first name Ascending.
If you want Steve Allen first before Tom Brokaw then sort last name Ascending.
DougP, MCP
dposton@universal1.com

Ask me how Bar-codes can help you be more productive.
Or visit my WEB site
 
Thanks for responding. If I have a table with only one (1) record, how do I get that record displayed automatically when I open the form?

Lou Marles
 
If your problem is that your form is opening to a new record, then check the form's "Data Entry" property. If the property is set to Yes, this will cause the form to open to the new record, change it to No. It may be that you are opening the form using code. You may have something like:

DoCmd.OpenForm "YourFormName", , , , acFormAdd

If this is the case you may need code to opens the form in edit mode:

DoCmd.OpenForm "YourFormName", , , , acFormEdit

HTH
RDH


Ricky Hicks
rdhicks@mindspring.com

 
Thanks Ricky, I did have the "Data Entry" property set to "Yes". I changed it to "No" and now the form opens with the first record in the table, just as I wanted. Thanks again.

Lou Marles
lmarles@trentu.ca
 
the fastest easiest way to make a form look at a table is to use the wizard.

try this:
click on the Tables TAB and single click your table
Next click the "Insert"menu then Autoform (near the bottom)
in a few seconds you wil have a form with all fileds and it will be setting on th efirst record.

I use this method to create all my forms then I go in design view and edit it to suit my needs.
DougP, MCP
dposton@universal1.com

Ask me how Bar-codes can help you be more productive.
Or visit my WEB site
 
Thanks Doug,

I will try that method also.

Lou Marles
lmarles@trentu.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top