Solved

Bookmark causing error with acFormAdd

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

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

Title # Comments Views Activity
Sub Reports 8 23
Track name AutoCorrect info 14 48
How can I name a sub macro so Shift/F10 would work. 3 22
Format a Field AFTER UPDATE 5 29
This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

867 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

17 Experts available now in Live!

Get 1:1 Help Now