Access Command to run access, open to specific form and specific record


Joined
Oct 3, 2018
Messages
1
Reaction score
1
This thread https://www.pcreview.co.uk/threads/command-to-run-access-open-to-specific-form-and-specific-record.3395824/
was posted over 10 years ago and it is almost getting me to where I need to go. Was wondering if anyone other there can assist and help me to get this working?

I am trying to generate an HTML email from Access that will include a link to open another Access database to a specific record.

this was my line of code for the outgoing email:

"<TD align=center width=""10%""><a href=""C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE"" ""J:\SW Follow-up.accdb"" ;frmSW,SWID=" & rsBody.Fields![STWID] & """>" & rsBody.Fields![SWID].Value & "</a></TD>" & _

But that just opens MS Access and not the database.

Then I tried:

"<TD align=center width=""10%""><a href=""J:\SW Follow-up.accdb"" ;frmSW,SWID=" & rsBody.Fields![STWID] & """>" & rsBody.Fields![SWID].Value & "</a></TD>" & _

Even though that opens the database, it does not go to the desired record.

I created a module in the destination database - SW Follow-up following the example in the thread I noted above:

Dim varParms As Variant

varParms = Split(Command, ",")
If UBound(varParms) = 1 Then
DoCmd.OpenForm varParms(0), acNormal, , varParms(1), OpenArgs:=True
End If

and called it from an AutoExec Macro. The frmSW is set to be the Display form when the database opens.

What I don't understand is how the SWID gets passed from the email to the OpenArgs for the database so that the form opens on that record. Can anyone help me? Thank you.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top