hello to all, i got some problem in vb 6 in reports. actually i tried to create a simple ordering system, and i used ms acces for my database, now the problem is that when i generate a report it will show the first data of the row of the database. what i want is that to show the very last row of my database. of the report table. pls i need help. i will appreciate for any help.

Recommended Answers

All 4 Replies

Are you using datareport and data environment in as your reporting tool? If so then, you can filter your query result by just selecting the last record.
How? for example you have an autoincrement field (id) in your table then the last record would be the record with largest (id). So your query would be "select max(id) as id, field, field1, field2... from table".

How you know which is the last record in the database ?

Last record as per what ?

In a typical RDBMS environment the last row is not necessarily the last record.

Better try to use Order by Desc in the SQL query that you are using on specific column.

As I mentioned above, I used example with an autoincrement field, example (id),so the last record inserted is the max value of the id field. So to select the last record inserted, simply select the max value of the id field along with the other fields.

Are you using datareport and data environment in as your reporting tool? If so then, you can filter your query result by just selecting the last record.
How? for example you have an autoincrement field (id) in your table then the last record would be the record with largest (id). So your query would be "select max(id) as id, field, field1, field2... from table".

Ok i will try this. thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.