?
Solved

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

Posted on 2014-09-11
6
Medium Priority
?
222 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 85
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 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 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 1000 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 48

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 Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

743 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