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

Copy contents of above-cell to next record - when query is applied? 2

Status
Not open for further replies.

keun

Technical User
Jul 15, 2005
262
US
I am trying to make a data entry task a little easier. Normally, I use CTRL+' to copy the contents of the above text box into the next record. But in my form I have a query applied so this is not working.

Is there another way?

I have thought about two buttons by each Text Box: the first button will copy the contents of the Text Box, and then second button with paste the clipboard into the Text Box. So, the user will get to the populated Text Box, hit the copy button. Go down one record, hit paste button, next records paste, etc until she gets to the next Text Box with data. Hit the Copy button and move on down.

Thoughts on this?
 
This appears to only apply to new records. I have the records existing in the database already.
 
Another way you may wish to consider. This is placed in the KeyDown Event of the form. It uses the send key method which may fit your needs.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'Turns off the ESC Key Must be in KeyDown, KeyPress, & KeyUp
Dim strKey As String
strKey = Chr(KeyCode)
If KeyCode = 27 Then
KeyCode = 0
End If

'If the F2 Key has been Pressed, the Field from the previous invoice is duplicated

Select Case KeyCode

Case vbKeyF2 'Duplicate The Field From The Previous Record
SendKeys "^(')"

End Select

Exit Sub
End Sub
 
How are ya keun . . .

Can be done with a [blue]simple double-click[/blue] of the textbox of interest (the previous record textbox is copied).

Setup:
[ol][li]In the forms code module, copy/paste the following routine.
Code:
[blue]Public Sub PrevRecVal()
   Dim Nam As String, hldVal
   
   Nam = Screen.ActiveControl.Name
   
   If Me.CurrentRecord > 1 Then
      Me.Recordset.MovePrevious
      hldVal = Me(Nam)
      Me.Recordset.MoveNext
      Me(Nam) = hldVal
   End If

End Sub[/blue]
[/li]
[li]In the [blue]On Dbl Click[/blue] event of each textbox of interest, copy/paste the following.
Code:
[blue]   Call PrevRecVal[/blue]
[/li]
[li]Done![/li][/ol]
[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
LOVIN' IT!

AceMan, you rock. This is amazing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top