Solved

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

Posted on 2014-09-11
6
218 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 46

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

829 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