Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Open form to current record, but then cann't change record

Posted on 2009-04-07
3
Medium Priority
?
228 Views
Last Modified: 2013-11-27
I have a button that opens a for to the current record, unless there is no record at which point is opens the form in add mode:

If IsNull(Me.BorrowerInquiryID) Then
    DoCmd.OpenForm "frmPasswords", acNormal, , , acFormAdd

Else
    DoCmd.OpenForm "frmPasswords", , , "[BorrowerInquiryID]= " & Me.BorrowerInquiryID & ""

This works fine; however, on frmPasswords I have a combo box that allows the user to chose another "borrower's inquiry."  When I open the form directly from the navigation pane, the combo box works find; when I open the from with the button as programmed above, the combo box does not go to the selected record:

    DoCmd.SearchForRecord , "", acFirst, "[VHDABorrowerInquiryID] = " & Str(Nz(Screen.ActiveControl, 0))

What can I do to my button's code so it does not lock the frmPassword to one record?

Thanks!
0
Comment
Question by:Phereklos
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24092735

If IsNull(Me.BorrowerInquiryID) Then
    DoCmd.OpenForm "frmPasswords", acNormal, , , acFormAdd

Else

'this part of the code is limiting the records in frmPasswords to one

    DoCmd.OpenForm "frmPasswords", , , "[BorrowerInquiryID]= " & Me.BorrowerInquiryID & ""

end if


use this codes instead

If IsNull(Me.BorrowerInquiryID) Then
    DoCmd.OpenForm "frmPasswords", acNormal, , , acFormAdd

Else

'this part of the code is limiting the records in frmPasswords to one

    DoCmd.OpenForm "frmPasswords", Openargs:= Me.BorrowerInquiryID
end if

' NOW in the load event of frmPasswords place this codes

private sub form_load()

if len(me.openargs)>0 then
  with me.recordsetclone
      .findfirst "[BorrowerInquiryID]= " & Me.Openargs

      if not .nomatch then
           me.bookmark=.bookmark
           else
             msgbox "Record not found"
      end if
  end with

end if

end sub
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 24092738
use this codes instead

If IsNull(Me.BorrowerInquiryID) Then
    DoCmd.OpenForm "frmPasswords", acNormal, , , acFormAdd

Else

    DoCmd.OpenForm "frmPasswords", Openargs:= Me.BorrowerInquiryID
end if



' NOW in the load event of frmPasswords place this codes

private sub form_load()

if len(me.openargs)>0 then
  with me.recordsetclone
      .findfirst "[BorrowerInquiryID]= " & Me.Openargs

      if not .nomatch then
           me.bookmark=.bookmark
           else
             msgbox "Record not found"
      end if
  end with

end if

end sub
0
 

Author Closing Comment

by:Phereklos
ID: 31567805
Thank you.  I will read up on openargs - haven't used that yet.  Appreciate your help.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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.

719 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