Insert the data from the same field in the previous record CTRL+'

D

desireemm

I inherited a database that I changed to an AdP, now the users are saying
they want the CTRL +' ability back and the ADP doesnt seem to do that. I
have a main form and a subform, the subform is wher they will enter things
like hours into a participants record then they use the short cut key after
moving to a different record but it doesnt work and I dont know why. the UI
is Access 2007 and the Back end is SQL 2005. I dont knwo how I'm going to
get that featue back. can anyone help because according to MS site that is
suppose to still be there
 
S

S.Clark

Ctrl+' (Apostrophe) is the Office feature for "Ditto", which copies the value
from the same column of the Row above it. This can be demonstrated in an
Excel Spreadsheet or Access table.

This feature does not exist in SQL Server (afaik), which is why it doesn't
work in your ADP... it's a linked data source, not an Access table.

You could recreate this function using the AutoKeys macro, or the OnKeyPress
of the form.

Steve Clark, Former Access MVP
Twin-Soft.com
 
D

desireemm

thank yoiu so much Clark I have been trying to get an answer to this for a
while, please tell how I would create this macro? thank you
 
S

S.Clark

I think I would use the OnKeyPress of the form. So, go to the module for the
form, and start a new proc for that event.

Next, you have to figure out what the 'previous' record would be. (This is
very subjective, as the data can be sorted in any form or fashion.) But,
let's suppose that your data is sorted in order by ID. For this case, I
would then use some lookup function (e.g. DLookup, DMax) to find the record
with the next lowest ID. So, if I was on record 14, I would DMax() for the
largest ID that is less than 14.

From there, you can use that ID to retrieve the value from the column of
that record using Dlookup, or a recordset find.

Sorry I can't give you the exact code, but my current DEV env doesn't have
SQL server that I can use for practice.
 
D

desireemm

Hi all I am trying to figure out how recreate the CTRL+' function using the
AutoKeys macro, or the OnKeyPress of the form.
I know how to create a macro but I have never created an AutoKey. Can anyone
assist?? Pls I did some research and it can be done through a macro
Here is my situation, We swicth from having a mdb to having an ADP, and the
users were using shortcut keys that were supported throught the MDB but since
we changed to an ADP (SQL 2005 as Engine) the short Cut Key CTRL + Apostrophe
( Insert the data from the same field in the previous record CTRL+'
) no longer works and I need to find a work around for it. Its like a Ditto
Key and since I dont know allot about VBA I'm unsure as to what to do. I
used the code below but insertng it into the Properties of the Text box in
the AFterUpdate Event but it doesnt work. When the user enters data into one
record it looks like its copying the data over to the correct fields, but it
actually doesnt, I know this because I opened the table and no data was
copied over. Can someone please help.


Private Sub Earned_hours_AfterUpdate()
Me.Earned_hours.DefaultValue = """" & Me.Earned_hours.Value & """"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top