Problems with Printing the current record 
Author Message
 Problems with Printing the current record

Hi there! I'm having trouble with printing the current record. First of
all, I have a form where I add new records about employees named
"frmEmployees". What I would like is to add the new record and then print
such record.  But most of you might know that after you're in the last
field and press enter, you move to a new record. My question is how can I
add a new record and print it (just the newly added record) without having
to move to a new record.

If you have any suggestions, I'll be glad to read them.
Thanks in advance

Felix Melendez
Managua, Nicaragua



Sat, 25 Dec 1999 03:00:00 GMT  
 Problems with Printing the current record

Felix:

Hola!

You didn't state what version of Access you are using so I'll try to be
generic. I am assuming that you want to do the following sequence:
SaveRecord, Print Record, Move to NewRecord.

What you need to do in Access 2 is to trap the key stroke on the last field
of the form using the OnKeyDown event, and look for Key_Tab, Key_Return or
Key_Right key presses.  Then you simply use the code to ignore the key
value  (Note the hex values for these keys is located in the constant.txt
file which is installed with access 2,)  So your code might look something
like:

Sub MyControl_KeyDown(KeyCode, Shift)

        Select Case KeyCode

        Case Key_Tab, Key_Return, Key_Right
                KeyCode = 0             'Set the value of the Key to 0 to tell Access to ignore
                DoCmd.DoMenuItem ..... 'Save the Record
                DoCmd.Print
                DoCmd.DoMenuItem..... 'Move to the new record
        End Select

End Sub

Now in Access 97, this is a little easier, because you can just set the
"cycle" property of the form to the current record so it doesn't
automatically move on to a new record, and then either use a command button
for the save action which saves, prints and moves to the next record, or
you can use the same type of code in the last control, (note however that
in Access 95 & 97 the key values are intrisic constants in Access for those
versions so you can use vbKeyReturn etc.)

HTH
--
Steve Arbaugh
ATTAC Consulting Group
http://ourworld.compuserve.com/homepages/attac-cg/acgsoft.htm
Reply Address adjusted to control spams remove leading ~



Quote:
> {Snip} What I would like is to add the new record and then print
> such record.  But most of you might know that after you're in the last
> field and press enter, you move to a new record. My question is how can I
> add a new record and print it (just the newly added record) without
having
> to move to a new record.

> Thanks in advance

> Felix Melendez
> Managua, Nicaragua



Sun, 26 Dec 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Print current record btn

2. printing current record?

3. Print current record?

4. Print current record?

5. Print only the current record

6. PRINT CURRENT RECORD ONLY!

7. Printing Current Record

8. How can i print report based on a current record (from a dataentry form)

9. Printing Current Record Through Report?

10. Printing current record

11. Printing the current record

12. Printing only current displayed record (VB)

 

 
Powered by phpBB® Forum Software