open an access form with a specific record using a hyperlink.

  • Thread starter Thread starter EricB
  • Start date Start date
E

EricB

This might be a strange question but I'm trying to do the following:
I created in ms access a function that sends an e-mail using outlook
automation, in the e-mail it displays the record keynr, I also created a
hyperlink that tells the users to click on and it will open for them the ms
access application. Basically what I would like to do is that it opens a
specific access form with the specific record for which the record keynr is
specified in the e-mail send to them, so the form should only display the
record for which they need to take any action on. I really do not know
whether this can be accomplished. Does anybody has any idea whether this can
be done? Thanks in adavnce.
 
Hi,
you can run your application with commandline argument like /cmd
RecordID=1234

then you can read this commandline in access using Command() function, get
record number and open form on this record

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 
Alex,

I created the following function in my access application:

Public Function CheckCommandLine(intrecid)

Dim stLinkCriteria As String
stLinkCriteria = "[fldCPARnumber] = " & intrecid
DoCmd.OpenForm ("frmDetailOpenAction"), , , stLinkCriteria

End Function

In my command line I have the following:

"C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE"
Q:\SHARED\CPAR\ACCDB\CPAR.accdb /cmd fldCPARNumber=385

But when I launch the application it does not want to open the form with
that specific recordid. I ahve no idea where it gies wrong here. Thanks much!
 
Alex,

I found the problem, I had to adjust the function to this:

Function CheckCommandLine()
stLinkCriteria = Command()
DoCmd.OpenForm "frmDelailOpenAction", , , "[ID] = " & stLinkCriteria
End Function

Thanks for all your help!



EricB said:
Alex,

I created the following function in my access application:

Public Function CheckCommandLine(intrecid)

Dim stLinkCriteria As String
stLinkCriteria = "[fldCPARnumber] = " & intrecid
DoCmd.OpenForm ("frmDetailOpenAction"), , , stLinkCriteria

End Function

In my command line I have the following:

"C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE"
Q:\SHARED\CPAR\ACCDB\CPAR.accdb /cmd fldCPARNumber=385

But when I launch the application it does not want to open the form with
that specific recordid. I ahve no idea where it gies wrong here. Thanks much!



Alex Dybenko said:
Hi,
you can run your application with commandline argument like /cmd
RecordID=1234

then you can read this commandline in access using Command() function, get
record number and open form on this record

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 
Eric,

I'm struggling with the exact same problem and I can't get my head around it.

As far as the code for sending an e-mail with a hyperlink in it that's no
problem but how do I point it to the record that I want. Here's the code I
got so far:

Private Sub Knop46_Click()

DoCmd.SetWarnings False
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Dim strHTML As String
Dim strHyperlink As String
Dim strExportDirectory As String
Set olApp = Outlook.Application
Set objMail = olApp.CreateItem(olMailItem)
strHyperlink = "file:///C:\Windows\"
strHTML = "<HTML><Body>Test Body.<p><p><a Href=" & strHyperlink & "
target=new>Testing Link</a></body></html>" 'The Testing Link is the message
that appears in blue to be clicked. Change to fit your needs
With objMail
..BodyFormat = olFormatHTML
..HTMLBody = strHTML
..To = "(e-mail address removed)"
..Subject = "Some Subject"
..Display
End With
Set olApp = Nothing
Set objMail = Nothing

DoCmd.SetWarnings True
End Sub

Can you help me?.

Cheers,

Paul

EricB said:
Alex,

I found the problem, I had to adjust the function to this:

Function CheckCommandLine()
stLinkCriteria = Command()
DoCmd.OpenForm "frmDelailOpenAction", , , "[ID] = " & stLinkCriteria
End Function

Thanks for all your help!



EricB said:
Alex,

I created the following function in my access application:

Public Function CheckCommandLine(intrecid)

Dim stLinkCriteria As String
stLinkCriteria = "[fldCPARnumber] = " & intrecid
DoCmd.OpenForm ("frmDetailOpenAction"), , , stLinkCriteria

End Function

In my command line I have the following:

"C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE"
Q:\SHARED\CPAR\ACCDB\CPAR.accdb /cmd fldCPARNumber=385

But when I launch the application it does not want to open the form with
that specific recordid. I ahve no idea where it gies wrong here. Thanks much!



Alex Dybenko said:
Hi,
you can run your application with commandline argument like /cmd
RecordID=1234

then you can read this commandline in access using Command() function, get
record number and open form on this record

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com



This might be a strange question but I'm trying to do the following:
I created in ms access a function that sends an e-mail using outlook
automation, in the e-mail it displays the record keynr, I also created a
hyperlink that tells the users to click on and it will open for them the
ms
access application. Basically what I would like to do is that it opens a
specific access form with the specific record for which the record keynr
is
specified in the e-mail send to them, so the form should only display the
record for which they need to take any action on. I really do not know
whether this can be accomplished. Does anybody has any idea whether this
can
be done? Thanks in adavnce.
 

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

Back
Top