UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Linking Error In Access, Access 2016    
 
   
EllenMarie
post Oct 21 2019, 12:16 PM
Post#1



Posts: 212
Joined: 4-August 10



Hello

I am developing a database that contains a report that lists training requests that employees enter into this database.
The report is based on 2 tables. (Parent table: Employee table Child table: tbl_Request).

In this report, I've hyperlinked the primary keys which are the first two columns (Emp_ID and Request_ID).
What I am trying to do is isolate a single request submitted by an employee when I click on these hyperlinks.
When I click on the Emp_ID hyperlink for any record, Access successfully opens up the records for that user.
However, I need Access to open up a specific request that an employee has submitted which is where the Request_ID comes into play.

Here is the problem:
I am getting a runtime error message (type mismatch 13) when I click the Request_ID link. I am pretty certain the problem is in my where clause (code below).

DoCmd.OpenForm cstrForm, acNormal, WhereCondition:="[Emp_ID]=" & Me.Emp_ID And "[Request__ID]=" & Me.Request__ID

Any help is appreciated.
Go to the top of the page
 
theDBguy
post Oct 21 2019, 12:18 PM
Post#2


Access Wiki and Forums Moderator
Posts: 76,602
Joined: 19-June 07
From: SunnySandyEggo


Hi. Try it this way.
CODE
DoCmd.OpenForm cstrForm, acNormal, WhereCondition:="[Emp_ID]=" & Me.Emp_ID & " And [Request__ID]=" & Me.Request__ID

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
EllenMarie
post Oct 21 2019, 12:22 PM
Post#3



Posts: 212
Joined: 4-August 10



here's the file
Go to the top of the page
 
theDBguy
post Oct 21 2019, 12:24 PM
Post#4


Access Wiki and Forums Moderator
Posts: 76,602
Joined: 19-June 07
From: SunnySandyEggo


Hi. Did you try the code I posted? Just curious...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
dmhzx
post Oct 21 2019, 12:25 PM
Post#5



Posts: 7,115
Joined: 22-December 10
From: England


What dbGuy has done is to mover the quote marks to before the " And"

I would also put some spaces in each side of both "=" signs. Possibly not needed, but a useful habit IMO

Are you sure that your Request ID has two underscores?
Go to the top of the page
 
EllenMarie
post Oct 21 2019, 12:25 PM
Post#6



Posts: 212
Joined: 4-August 10



here's the file
Attached File(s)
Attached File  FORUM.zip ( 62.37K )Number of downloads: 3
 
Go to the top of the page
 
EllenMarie
post Oct 21 2019, 12:36 PM
Post#7



Posts: 212
Joined: 4-August 10



I made the modification in my where clause and this does eliminate the runtime error I was getting. Thanks.

Unfortunately, when I click on the Request_ID hyperlink, Access displays the parameter window asking me to type in the Request_ID manually. I would like Access to open up the record automatically when I click on the hyperlink. I was able to upload the sample database so you can examine it.

Thanks in advance.
Go to the top of the page
 
cheekybuddha
post Oct 21 2019, 01:16 PM
Post#8


UtterAccess VIP
Posts: 11,743
Joined: 6-December 03
From: Telegraph Hill


Check how you have spelt Request_ID in your code. It appears to have 2 underscores. Does that relate correctly to the actual field name in the table and also the name of the control in the form?

--------------------


Regards,

David Marten
Go to the top of the page
 
EllenMarie
post Oct 21 2019, 01:18 PM
Post#9



Posts: 212
Joined: 4-August 10



Hello,

The Request_ID did indeed contain two underscores! I am not sure how I did that, but thanks! That was my other problem. The parameter window is gone.
Thanks for your help!
Go to the top of the page
 
theDBguy
post Oct 21 2019, 01:47 PM
Post#10


Access Wiki and Forums Moderator
Posts: 76,602
Joined: 19-June 07
From: SunnySandyEggo


Hi. Glad to hear you got it sorted out. Good luck with your project.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
cheekybuddha
post Oct 21 2019, 01:55 PM
Post#11


UtterAccess VIP
Posts: 11,743
Joined: 6-December 03
From: Telegraph Hill


thumbup.gif

--------------------


Regards,

David Marten
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    21st November 2019 - 01:31 AM