Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fill listbox with records when DataEntry=true

Status
Not open for further replies.

LPent

Programmer
Oct 3, 2002
50
TR
I have a (sub)form with the property "DataEntry" set to True (so only new records that are added are visible).
I need a listbox on this form that lists all the newly added records.
What do I have to set the RowSource property to for the listbox to accomplish that?
SELECT * FROM tblName; lists all the records, and that's not what I want.

(I know I must use listbox.requery each time I add a new record to update the listbox)

LP
 
add to your table a date\time field called timecreated set default value to now
on your form create txtbox called openedform it can be invisible default value = now
put the tab stop value of this txtbox smaller then the list box
change your list box sql to select * from tablename where timecreated>me.openedform
 
Interesting solution... But that is not what I want. I can't add fields to the table. The table is already in use at the customers site.
LP
 
do you have a unique index (primary key) on the table if so
create a new table and as you add to the first table add the unique index to the new table the sql of the list box should be select * from tlbname inner join unique index on unique index
requery list after adding record
on form close delete all records from new table
 
Thnx,

It's not a very elegant solution but it will do. I think it's strange Access doesn't have a better construct for this.
btw. I have changed one thing:
I Empty the temporary table on OPENING the form, not on closing because if you only empty it on closing and access crashes (or closes down unexpectantly for some other reason) next time you open the form, you'll have a populated temp-table.

LP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top