• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

next record

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
col_jack_oneal
Asked:
col_jack_oneal
  • 3
  • 3
  • 2
  • +1
1 Solution
 
mlmccCommented:
You could use the KEYPRESS event for the control or the form.  

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

mlmcc
0
 
col_jack_onealAuthor Commented:
no doesnt work, mlmcc
0
 
mlmccCommented:
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
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
diarmaidCommented:
Should be able to do something in KeyPress event like

If (KeyAscii = 13) then
  ReplaceWithDataControlName.Addnew
  ReplaceWithDataControlName.Movelast
end if
0
 
col_jack_onealAuthor Commented:
method or data member not found, highlights .addnew
0
 
diarmaidCommented:
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
 
leonstrykerCommented:
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
 
col_jack_onealAuthor Commented:
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
 
diarmaidCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now