Solved

Create New Record using Command button on Separate form

Posted on 2008-10-28
16
4,654 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

911 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

19 Experts available now in Live!

Get 1:1 Help Now