PDA

View Full Version : Get the record number out of a List



v1ech
07-09-2010, 04:13 AM
Hello guys!

I m struggling with a small problem and i hope you guys can help me.

I m using Access2k7 and i have built up a small tool with a form based on a table to work with the records in the table.

In my Form i have a List displaying all the records in my table.
What i m now trying to do is marking a record in my List, click a Button and get the Number of this record.

The plan is to open another form for editing the record, and i need the number to navigate to the marked record in the new form.

I do have an ID Autovalue but this is not equal to the number of the record since sometimes i have to delete a record and the ID just remains the same with the deleted one missing.

I would like to solve this with VBA so i d be happy if you guys knew help!

Thanks in advance!

Regards,

Oliver

OBP
07-09-2010, 06:05 AM
Oliver, I am not sure why you are using a List rather than a Form in Continuous Mode or a Subform?

v1ech
07-09-2010, 06:25 AM
Oliver, I am not sure why you are using a List rather than a Form in Continuous Mode or a Subform?

i already thought about using a subform as well but i decided to use a list because its safer...

this tool is made for guys who are not that good in using such stuff so it has to be as safe as possible... they shouldnt be able to accidantly change something of the records.

So i built the form for working with the data based on a list with all the stuff around it.
Furthermore i now have the ablity to create a logfile system putting every action like a clicked button into an own logfiletable which is important for our stockmanagement


Btw i already found a solution for my problem:

dummy = Me!ListeBtl.Value
IDs = DLookup("ID", "tbl_mech_Bauteile", "[ID] Like " & Chr$(34) & dummy & Chr$(34))
DoCmd.OpenForm "frm_mech_Bauteil_hzf", , , "[ID]=" & CStr(IDs)