Solved

next record

Posted on 2003-11-11
9
235 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run code from text file in vb 1 57
message box in access 4 41
Looking for VB6 code to read SQL table export it to ascii 8 33
Exit a vb6 apps when a calling it apps closes 15 43
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 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…

896 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

12 Experts available now in Live!

Get 1:1 Help Now