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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 Code Questions

Status
Not open for further replies.

Accesser

Technical User
Jun 3, 2002
44
0
0
US
Hi there,

Would anyone know how to code the following?

1st Code Problem:
In a table/query, search through the records and

identify all the records that are identical except for their values in 1 field (of any field in the query), then

in a dummy field added to the query, concatenate the different values of the records in the 1 field into the dummy field for each related record,

in effect, making each of these similar records identical (once the 1 field is later removed).

If this is doable, then the code would then also need to ID the records that are identical except for their values in 2 fields (any), and do the same as above.


2nd Code Problem:
Do something like the DoCmd.GoToRecord , , acPrevious, but instead of acPrevious meaning the record just before the current record (current rec will be the last record in this case), the recordset should go back to the record that the user was just previously at--which doesn't have to be the record incrementally right before the current record.

For instance, a user could be browsing a record in the middle of the set, then click on a button that moves the user to the new rec, where another button could be clicked to return the user to the record in the middle of the set.

So far, I have:

Private sub cmdRecords_Click() (or could use a toggle btn)

Dim rs as object
Dim iID as long

If not me.newrecord then
iID = Me!ID
End if

Set rs = Me.recordsetclone
rs.findfirst "ID =" & iID
If not rs.nomatch then
Me.Bookmark = rs.Bookmark
End if
rs.close
set rs = nothing
end if

The main prob is that a new record now has its own ID (autonum); and this code seems to overwrite the old record's ID with the new record ID.

My head is beginning to hurt. Any helpful insights/instruction would be greatly appreciated.

Thanks,
Eric
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top