Solved

next record

Posted on 2003-11-11
9
233 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
Comment Utility
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
Comment Utility
no doesnt work, mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
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
 
LVL 2

Expert Comment

by:diarmaid
Comment Utility
Should be able to do something in KeyPress event like

If (KeyAscii = 13) then
  ReplaceWithDataControlName.Addnew
  ReplaceWithDataControlName.Movelast
end if
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

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

Expert Comment

by:diarmaid
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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 …
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now