View Full Version : opening a form at the last record


John Thomson
09-14-2000, 12:17 AM
I must be missing something pretty obvious

I have a form built on a simple query, this is created from two linked tables, I have tried to use a macro attached to the open form event to goto the last record.

I am told the query is not open, if I open the query I get the query running, I do not want this I only want to go to the last record to use one of the fields when I add a new record

many thanks

John

Robert Dunstan
09-14-2000, 07:37 AM
Firstly you say you are told the query is not open. Is this an Access error message you are getting?

In your macro the actions should read as follows:

1. OpenForm - then in the box at the bottom left enter your form name and set any other conditions as necessary

2. GoToRecord - ensure that 'Record' is selected as Last

Attach the macro to your form's OnOpen event and also check the form's record source is set to the query. Now when you open the form it should run the macro and display the last record

Hope this helps
Rob

John Thomson
09-15-2000, 12:14 AM
Robert

Yes, it is an Access error message the object 'tblquery' is not open

I tried your suggestion but got the same error.

(it seems funny to have a macro action open form attached to the open form event)

What I would like to do is open a form with the last record as the current record, I can do this using a recordset in a module but I feel there must be an easier way

imagine one table, with 2 field - table_code autoincrement, table_text text

3 entries 1 text 1, 2 text 2, 3 text 3

a simple columnar form using this table, how do I get the form to open with 3 text 3 displayed

thanks for your help

John

Robert Dunstan
09-15-2000, 07:01 AM
John

OK I'll go through the simple suggestions first.

1. Is your query a simple select query based directly on your tables or does it rely on another query for its data?

2. Is your form's record source set to the query?

3. Is your form's default view single form, continuous forms or datasheet?

I know these questions sound silly but in my experience the solution to a problem is usually the most obvious although you can't see it at the time.

If you are still having problems then e-mail me your database and I'll have a look for you.

John Thomson
09-15-2000, 03:59 PM
Richard, thank you for your patience

I will answer your questions

1 Yes it is a simple select query
2 Yes the record source is the query
3 The default view is single form

You say I could e mail the database, it is very small, how do I do this?

Thank you

John

Robert Dunstan
09-17-2000, 03:55 AM
John,

If you want to e-mail me the .mdb then do the following:

1. Open your e-mail program and select new mail. My e-mail address is robertdunstan@dunstanr.freeserve.co.uk

2. Assuming you use Outlook Express there should be a button on the toolbar that has a paper clip icon. This is the 'Attach' button. Click this and a dialog box will open allowing you to select the file to attach. Once you select it the filename and size should appear under the subject of the e-mail.

3. Click 'Send' to send the e-mail to me.

Once I get it I'll have a look for you and send it back with any help that I can give

Rob

John Thomson
09-18-2000, 11:00 AM
Rob


I do noy know where I got the 'Richard' from, sorry.

I think I have solved my problem, with the use of RecordsetClone and Dlookup.

More importantly, it is clear I should rethink my whole approach to the project

Thanks again, sorry about the name thing

John