Solved

Issue with linking a form to another form (specific record)

Posted on 2014-09-11
6
215 Views
Last Modified: 2014-10-09
I have an issue where I am trying to link records to a specific record. So when you click on the record in an access form, it should open up the form with that record.

Now I have to mention that the field with the criteria is a text ( I had to do a text rather then a number for specific reasons)

I created a macro which runs onclick and I have attached the picture of what the macro shows. I have done this several other times.

However, when I click on the field with the onclick action it gives me a "data mismatch criteria error"

I know both fields are text. Does access maybe convert one field into number? is there a workaround it?

thanks,
link.PNG
0
Comment
Question by:damixa
6 Comments
 
LVL 84
ID: 40317851
What's the Datatype of the [ID1] field on frm_Full_View1? And what is the value of [ID1] that you're passing in? Generally speaking, Datatype Mismatch means exactly what it says - the data you're using doesn't "match" the datatype you're working with.
0
 

Author Comment

by:damixa
ID: 40317855
Thats the thing, they are both text
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 250 total points
ID: 40317862
Then you must enclose the "value" in single quotes. Your Where condition should be something like:

"[ID1]='" & [ID1] & "'"

I'm not sure if you need the preceding "=" in there or not ... I've not used macros in a looong time.
0
 
LVL 31

Accepted Solution

by:
Helen_Feddema earned 250 total points
ID: 40319414
Alternatively, you can use Chr(39), which is longer but easier to decipher than a nest of single and double quotes.  It is also advisable to save the value from the form to a variable, so you can examine it in the Immediate Window.

This is for VBA code -- I don't think you can set a variable in a macro, but the other line should work.

strID = Me![ID1]
"[ID1] = " & Chr(39) & strID & Chr(39)
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40370222
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now