How do I show the last record entered from my database in a Bound Textfield?

ismith

Registered User.
Local time
Today, 17:33
Joined
Dec 14, 2011
Messages
30
Hello,

I have a form with bound textfields.

These used to show the last record that was entered in it by using:

Code:
Forms!frmProduct.Recordset.FindFirst "ProductID = " & DMax("ProductID", "tblProduct")


that code used to work and it used to show the last product in the databse.

What ive done right now is ive opened a form from Create -> More Forms -> Modal Dialgos

and ive pasted the same form and the same code into that.

Its now giving me an error which says:

Run Time Error '91'
Object vairable or with Block variable not set.

How can i sort this out and populate the bound fields with the last record in the databse?

Thanks..
 
* Create a query based on tblProduct
* Sort by ProductID in DESC
* Set the TOP VALUES property of the query to 1
---------------------------------------------------------
The most recent entry will be displayed when you run it
---------------------------------------------------------
* Base a subform on this query in your form.
 
Thanks for your reply.


Ive created a query on my Product Table.

what do u mean by 'Set the TOP VALUES property of the query to 1'?

And another thing i wanted to know was is there any other way to do it besides this? Like having some coding as ive shown above.

That used to work but since ive created a form using the Modal Dialog nw its giving an error.
 
Basically the SQL statement should read:
Code:
SELECT [COLOR=Red]TOP 1[/COLOR] [field1], [COLOR=Blue]...etc[/COLOR]
 
And another thing i wanted to know was is there any other way to do it besides this? Like having some coding as ive shown above.
I'm sure I didn't make any reference to code in the steps explained.
 

Users who are viewing this thread

Back
Top Bottom