Solved

Create New Record using Command button on Separate form

Posted on 2008-10-28
16
4,678 Views
Last Modified: 2013-11-28
Problem:  Unable to create new record.
Description:   On "frmMain", I have "cmdAddNew" button (Caption : + Person).  "cmdAddNew" should open up "frmProfile" and create a new record for editing.  However, I keep getting the "You can't go to specified record" error.  
IMED-Test.zip
0
Comment
Question by:njmatt
  • 9
  • 7
16 Comments
 
LVL 75
ID: 22825331
Can  you post the code for the command button?

mx
0
 
LVL 1

Author Comment

by:njmatt
ID: 22825344
I posted the DB as well if you need to take a look.  
Private Sub cmdAddNew_Click()
     DoCmd.OpenForm "frmProfile"
     DoCmd.GoToRecord , , acNewRec
     
End Sub

Open in new window

0
 
LVL 75
ID: 22825404
Quick fix:

Private Sub cmdAddNew_Click()
     DoCmd.OpenForm "frmProfile"
     On Error Resume Next                                '*** add this
     DoCmd.GoToRecord , , acNewRec
     Err.Clear                                                     '* add this
     
End Sub
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:njmatt
ID: 22825422
That gets rid of the error prompt, however does create a new record for editing.  
0
 
LVL 75
ID: 22825454
I assume you mean does 'not' ?

On the form you are trying to open, check the Form's Allow Additions property - It should be set to Yes - and well as Allow Edits.

mx
0
 
LVL 1

Author Comment

by:njmatt
ID: 22825465
Thanks, yea I meant not.  Yes, those settings are in place.  I have gone through a handful of posts on this issue to no avail.  
0
 
LVL 75
ID: 22825489
ok ... when the form opens, what DO you see ?

mx
0
 
LVL 1

Author Comment

by:njmatt
ID: 22825498
It opens up "frmProfile" to the first record in the DB with all related data...The navigation selectors on the bottom are enabled, however the "New (blank) record" button is not enabled.
0
 
LVL 75
ID: 22825532
That would only happen if:

1) Allow Additions was NO ... or
2) The Form's RecordSource is not updateable.

Can you Compact & Repair (to shrink the size), then zip up the MDB, then attach the file for upload here (using the 'Attach File function below) ... removing any sensitive data of course? And please give a clear explanation of exactly how to reproduce the problem.

mx
0
 
LVL 1

Author Comment

by:njmatt
ID: 22825564
I attached the file in my initial post.

Open "frmHome"
   -> Click on "Employee Database"
       -> Click on "+ Person"
          -> This will bring you to the Profile form where I am unable to add a new record.

Thanks.
0
 
LVL 75
ID: 22825882
Very strange.  As long as frmMain is open, the nav add button is grayed out on frmProfile.  IF you open frmProfile by itself, it's ok !

Trying to track this down.

mx
0
 
LVL 1

Author Comment

by:njmatt
ID: 22825896
Yea, I noticed that.  It is very strange.  I'm continuing my search for answers..I appreciate your help.
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 250 total points
ID: 22826011
Update:

The issue is the Record Source on frmMain

SELECT person.[last_name] FROM person;

If you remove that, frmProfile is ok.  

Werid
0
 
LVL 75
ID: 22826079
OK ... I found the problem.

On form Main - property sheet - Data tab - Records Locks is set to ALL records.  No can do.  Set to No Locks ... here and everywhere.

mx



0
 
LVL 1

Author Comment

by:njmatt
ID: 22826109
Wow, always something simple like that.  That does the trick.  Thanks.
0
 
LVL 75
ID: 22826173
A bit unusual that would be set to All Records!  

You are welcome.

mx
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

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.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

680 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