Solved

Help! DoCmd.GoToRecord , acDataForm, acNewRec??  doesn't work

Posted on 2002-05-30
3
3,017 Views
Last Modified: 2008-03-10
I am trying to enter a new record. The code I have written overwrites an existing record (not good). How do I enter a new record in code. I am using

'open the form to access it
        DoCmd.OpenForm "frmmaintenance", acNormal, , , acFormAdd, acWindowNormal
       
        'Make new record
         Form_frmMaintenanceSub.Customer.SetFocus
         DoCmd.GoToRecord , acDataForm, acLast
         DoCmd.GoToRecord , acDataForm, acNewRec ??
'Setfocus on text box then write to it
        Form_frmMaintenanceSub.Customer.SetFocus
        Form_frmMaintenanceSub.Customer.Text = Me.txtCustname
        Form_frmMaintenanceSub.Request.SetFocus
        Form_frmMaintenanceSub.Request.Text = Me.description
        Form_frmMaintenanceSub.Priority.SetFocus
        Form_frmMaintenanceSub.Priority.Text = "Z - Non Proritised"

Any suggestions please
0
Comment
Question by:HPD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
James Elliott earned 200 total points
ID: 7044062
DoCmd.GoToRecord , , acNewRec
0
 
LVL 12

Expert Comment

by:James Elliott
ID: 7044072
So.

DoCmd.OpenForm "frmmaintenance"
DoCmd.GoToRecord , , acNewRec

With Form_frmMaintenanceSub
 .Customer.SetFocus
 .Customer.Text = Me.txtCustname
 .Request.SetFocus
 .Request.Text = Me.description
 .Priority.SetFocus
 .Priority.Text = "Z - Non Proritised"
End with

0
 

Author Comment

by:HPD
ID: 7045681
jell it now displays an error "Run time error '2105' you can't go to the specified record"
 I can go to the form "maintenance" (and subform "submaintenance")and use the standard menu bar to enter a new record but I need to be able to do it in code.

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

738 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