Phereklos
asked on
Open form to current record, but then cann't change record
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.BorrowerInquiryI D) 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.ActiveContro l, 0))
What can I do to my button's code so it does not lock the frmPassword to one record?
Thanks!
If IsNull(Me.BorrowerInquiryI
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.ActiveContro
What can I do to my button's code so it does not lock the frmPassword to one record?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you. I will read up on openargs - haven't used that yet. Appreciate your help.
If IsNull(Me.BorrowerInquiryI
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.BorrowerInquiryI
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