Solved

Bookmark causing error with acFormAdd

Posted on 2014-02-04
4
345 Views
Last Modified: 2014-02-04
Dear experts -
I open a form with the acFormAdd parameter. I DO want to enter this form in the 'enter record mode'.
That form also has a 'Search'  button, which invokes a popup form, from which one can select an existing record (same table).
Once a record is selected in the popup, it sets the bookmark in the calling form and closes the popup.
HOWEVER, this is generating a NO CURRENT RECORD error.
Any way around this?
Thanks -
0
Comment
Question by:terpsichore
4 Comments
 
LVL 4

Assisted Solution

by:Jack Leach
Jack Leach earned 200 total points
ID: 39832197
If the form is opened in DataEntry mode, it doesn't have access to any previous records, thus you can't search for any records.

Perhaps you'd like to move to a new record when the form is opened, instead of opening it in Data Entry mode?

Private Sub Form_Open(Cancel As Integer)
    DoCmd.GotoRecord , , acNewRec
End Sub

Open in new window


hth
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 300 total points
ID: 39832202
acFormAdd basically puts you into Data Entry Mode, so you can't edit records, therefore your bookmark would not be recognized as a valid record.

If you need to Enter AND Edit records in that form, you must open it in "normal" view. You can then take the user to a New record if needed like this:

DoCmd.RunCommand acCmdRecordsGoToNew

You might be able to use the OpenArgs method of the OpenForm method to instruct your form to move to a new record. For example:

DoCmd.OpenForm "YourForm", acNormal, , , , , "NewRecord"

Then in the form's Open or Load event:

If Nz(Me.OpenArgs, "") = "NewRecord" Then
  DoCmd.RunCommand acCmdRecordsGoToNew
End If
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39832276
you just need to revise the codes, wrap the codes that bookmark the record with

if me.newrecord=false then

  '  codes  to bookmark a record

end if
0
 

Author Closing Comment

by:terpsichore
ID: 39832332
perfect - many thanks.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Programmer 14 48
Access report groups with sums 5 26
Filter a form 8 14
access query to sql server 3 18
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…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
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 …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

770 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