Form opening the Last Record

S

Sharon Greene

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?
 
K

Klatuu

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.
 
S

Sharon Greene

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?
 
K

Klatuu

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?
 
Top