Form opening the Last Record

G

Guest

I created an Access database that is used to record help desk phone calls.
The database has a table (Problems), a form that allows users to add
problems, and another form that allows users to search for problems.

I would like to create a button for the main switchboard. When the user
clicks the button, a form should always open with the last problem that was
added to the table. The user should then be able to edit the information and
save it to the table. Each problem in the table has a unique identifier, so
the last problem entered is the one with the highest identifier.

How would I go about doing this?
 
G

Guest

Use the Where argument of the OpenForm method

Dim varUnique As Variant

varUnique = DMax("[Unique Identifier]","Call Table")
DoCmd.OpenForm "MyFormName", , , "[Unique Identifier] = " & varUnique

Make varUnique whatever data type your field is and put in the correct
delimiters in the OpenForm method.
 
G

Guest

Is it possible to create a form that opens with the last record when the user
clicks a button on the switchboard?

Klatuu said:
Use the Where argument of the OpenForm method

Dim varUnique As Variant

varUnique = DMax("[Unique Identifier]","Call Table")
DoCmd.OpenForm "MyFormName", , , "[Unique Identifier] = " & varUnique

Make varUnique whatever data type your field is and put in the correct
delimiters in the OpenForm method.
--
Dave Hargis, Microsoft Access MVP


Sharon Greene said:
I created an Access database that is used to record help desk phone calls.
The database has a table (Problems), a form that allows users to add
problems, and another form that allows users to search for problems.

I would like to create a button for the main switchboard. When the user
clicks the button, a form should always open with the last problem that was
added to the table. The user should then be able to edit the information and
save it to the table. Each problem in the table has a unique identifier, so
the last problem entered is the one with the highest identifier.

How would I go about doing this?
 
G

Guest

What I posted earlier will do that. You may have to create a public function
in a standard module and use the runcode in the switchboard manager.
Sorry if I am a little rusty on that. I don't really use the switchboard
manager much.
--
Dave Hargis, Microsoft Access MVP


Sharon Greene said:
Is it possible to create a form that opens with the last record when the user
clicks a button on the switchboard?

Klatuu said:
Use the Where argument of the OpenForm method

Dim varUnique As Variant

varUnique = DMax("[Unique Identifier]","Call Table")
DoCmd.OpenForm "MyFormName", , , "[Unique Identifier] = " & varUnique

Make varUnique whatever data type your field is and put in the correct
delimiters in the OpenForm method.
--
Dave Hargis, Microsoft Access MVP


Sharon Greene said:
I created an Access database that is used to record help desk phone calls.
The database has a table (Problems), a form that allows users to add
problems, and another form that allows users to search for problems.

I would like to create a button for the main switchboard. When the user
clicks the button, a form should always open with the last problem that was
added to the table. The user should then be able to edit the information and
save it to the table. Each problem in the table has a unique identifier, so
the last problem entered is the one with the highest identifier.

How would I go about doing this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top