Solved

next record

Posted on 2003-11-11
9
243 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create a duplicate finder Application 9 122
Put text in a picture ASP.NET C# 2 61
message box in access 4 51
Add a task in Outlook from access 11 42
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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

827 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