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

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
 
D

David H

Try using

Me.Earned_hours.DefaultValue = Chr(34) & Me.Earned_hours.Value & Chr(34)

I've never had any luck using literal quotes when working with Default Values.
 
D

desireemm via AccessMonster.com

Thank you David, what exactly does Chr(34) mean, what does that represent??

David said:
Try using

Me.Earned_hours.DefaultValue = Chr(34) & Me.Earned_hours.Value & Chr(34)

I've never had any luck using literal quotes when working with Default Values.
Hi all I am trying to figure out how recreate the CTRL+' function using the
AutoKeys macro, or the OnKeyPress of the form.
[quoted text clipped - 15 lines]
Me.Earned_hours.DefaultValue = """" & Me.Earned_hours.Value & """"
End Sub
 
D

Douglas J. Steele

Chr(34) is the representation of the double quote "

Since the DefaultValue property is a string (regardless of what's being
stored in it), you want the quotes around it, An alternative to using
Chr(34) would be

Me.Earned_hours.DefaultValue = """" & Me.Earned_hours.Value & """"


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


desireemm via AccessMonster.com said:
Thank you David, what exactly does Chr(34) mean, what does that
represent??

David said:
Try using

Me.Earned_hours.DefaultValue = Chr(34) & Me.Earned_hours.Value & Chr(34)

I've never had any luck using literal quotes when working with Default
Values.
Hi all I am trying to figure out how recreate the CTRL+' function using
the
AutoKeys macro, or the OnKeyPress of the form.
[quoted text clipped - 15 lines]
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