Solved

Bookmark causing error with acFormAdd

Posted on 2014-02-04
4
339 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 119

Expert Comment

by:Rey Obrero
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

9 Experts available now in Live!

Get 1:1 Help Now