Solved

next record

Posted on 2003-11-11
9
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 101

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 101

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
Technology Partners: 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

628 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