Solved

Create New Record using Command button on Separate form

Posted on 2008-10-28
16
4,643 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
 
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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 - Access MVP) 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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 …

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now