Solved

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

Posted on 2014-09-11
6
220 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 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 47

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

732 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