Solved

next record

Posted on 2003-11-11
9
246 Views
Last Modified: 2010-05-03
how can i make a newrecord appear when i hit enter

i am using a data control to access an MS access database.

Cheers guys
0
Comment
Question by:col_jack_oneal
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 9722700
You could use the KEYPRESS event for the control or the form.  

Something like
If (KeyAscii = vbCr) then
   rs.NextRecord
end if

mlmcc
0
 

Author Comment

by:col_jack_oneal
ID: 9722869
no doesnt work, mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 9723008
It may have to be

If (KeyAscii = 13) then
   rs.NextRecord
end if

Obviously th e rs. NextRecord needs to be changed to your datacontrol and the next record method

mlmcc
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:diarmaid
ID: 9723020
Should be able to do something in KeyPress event like

If (KeyAscii = 13) then
  ReplaceWithDataControlName.Addnew
  ReplaceWithDataControlName.Movelast
end if
0
 

Author Comment

by:col_jack_oneal
ID: 9723168
method or data member not found, highlights .addnew
0
 
LVL 2

Expert Comment

by:diarmaid
ID: 9723282
Sorry,

use the following in KeyPress

If (KeyAscii = 13) then
 ReplaceWithDataControlName.RecordSet.Addnew
'this creates a new record and moves the focus to that record. No need for the Movelast.
end if
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 9723356
col_jack_oneal,

How exactly did you bind the data to the control?

Please maintain your open questions

http://www.experts-exchange.com/Operating_Systems/WinXP/Q_20723290.html
http://www.experts-exchange.com/Hardware/Q_20557338.html

Leon
0
 

Author Comment

by:col_jack_oneal
ID: 9723465
diarmaid, it works in a command button but not on key press, i put it in the form keypress should it be somewhere else
0
 
LVL 2

Accepted Solution

by:
diarmaid earned 125 total points
ID: 9723521
Do you have the KeyPreview property of the form set to True?
You need to set this so the form intercepts the KeyPress before the controls.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question