Access MVP (2010-2015)

oOo.oOo.oOo.oOo.oOo.oOo

Hyperlink to open Forms

You’re using a Continuous Form, you can’t fit all your fields on the Form but you need to see and/or edit the record and you don’t want to use a Command Button.  (Sample file located at the bottom of the article.)  Here’s an alternate way to open the record with a Field…

Client List

Client List

a. Put an UNBOUND field on your Form and enter the below as the Control Source (Figure 1).  Note, where cpClientID is my Autonumber and Primary Key you should replace with your Autonumber and/or Primary Key…

=IIf(IsNull([cpClientID]),"(New)","Open")
Open New

Figure 1

b.  In the Properties Sheet window for your Field set the Display As Hyperlink to Always.  Note, you can leave the Font Color as Hyperlink Color or change to any color you like.  However, since most Users are accustomed to the blue it is safer to accept the default Font Color of Hyperlink Color.

Figure 2

Figure 2

c.  Now, just add a bit of code the On_Click event to open your details form (See sample of my frmClientProfile below)…

If (IsNull(txtClientID)) Then
    'If the Field displays (New)
    DoCmd.OpenForm "frmClientProfile", , , ,acFormAdd
Else
    'If the Field displays Open
    DoCmd.OpenForm "frmClientProfile", , ,"[cpClientID]=" & Me![txtClientID]
End If
frmClientProfile ~ New Record

frmClientProfile ~ New Record

frmClientProfile ~ Existing

frmClientProfile ~ Existing

To download a sample file click here

 2,842 total views,  1 views today

Comments are closed.