Link to home
Start Free TrialLog in
Avatar of col_jack_oneal
col_jack_oneal

asked on

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
Avatar of Mike McCracken
Mike McCracken

You could use the KEYPRESS event for the control or the form.  

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

mlmcc
Avatar of col_jack_oneal

ASKER

no doesnt work, mlmcc
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
Should be able to do something in KeyPress event like

If (KeyAscii = 13) then
  ReplaceWithDataControlName.Addnew
  ReplaceWithDataControlName.Movelast
end if
method or data member not found, highlights .addnew
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
diarmaid, it works in a command button but not on key press, i put it in the form keypress should it be somewhere else
ASKER CERTIFIED SOLUTION
Avatar of diarmaid
diarmaid

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial