i have form in 2016 access. when click buttom, went sort last name , first name. have sort last name (lastname.setfocus docmd.runcommand accmdsortascending) how do "then search first name). whole command:
private sub command50_mousedown(button integer, shift integer, x single, y single)
on error goto err_oplastname_mousedown
dim stwhatsearch string
stwhatsearch = inputbox("enter claimant's last name!")
claimant_name.setfocus
docmd.runcommand accmdsortascending
docmd.findrecord stwhatsearch, acstart, false, acsearchall, false, accurrent, true
exit_command50_mousedown:
exit sub
err_oplastname_mousedown:
msgbox err.description
resume exit_command50_mousedown
end sub
sort form last name first name need 2 rows of code, can follow code go first record matching last name entered in input box:
const message_text = "no matching record found."
dim stwhatsearch string
me.orderby = "lastname,firstname"
me.orderbyon = true
stwhatsearch = inputbox("enter claimant's last name!")
me.recordsetclone
.findfirst "lastname = """ & stwhatsearch & """"
if not .nomatch then
me.bookmark = .bookmark
else
msgbox message_text, vbinformation, "warning"
end if
end with
put above in button's click event procedure.
Office / Access / Windows 10 / Office 365 for business
Comments
Post a Comment