?
Solved

Create New Record using Command button on Separate form

Posted on 2008-10-28
16
Medium Priority
?
4,689 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
[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
  • 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
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 1000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Suggested Courses

764 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