[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Type Mismatch must by syntax

Posted on 2011-10-25
3
Medium Priority
?
315 Views
Last Modified: 2012-08-14
I really struggle with these situations where I need to use " or '. The line below is giving me a type mismatch error. Both variables are numeric. Where am I going wrong?

CurrentDb.Execute "UPDATE tblGoals SET TargetShare = " & Me.TargetShare & " where Crop_ID = " & Me.CurrentCrop And Location_ID = " & Me.CurrentLocation &"
0
Comment
Question by:Dale Logan
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 37029189

This assumes all data types are Numeric:
CurrentDb.Execute "UPDATE tblGoals SET TargetShare = " & Me.TargetShare & " where Crop_ID = " & Me.CurrentCrop & " And Location_ID = " & Me.CurrentLocation
0
 
LVL 75
ID: 37029197
If TargetShare is text, then:

CurrentDb.Execute "UPDATE tblGoals SET TargetShare = " & Chr(34) & Me.TargetShare & Chr(34) & " where Crop_ID = " & Me.CurrentCrop & " And Location_ID = " & Me.CurrentLocation





 
0
 
LVL 17

Expert Comment

by:Muhammad Khan
ID: 37029206
Is any of below fields a character type?
TargetShare
Crop_ID
Location_ID
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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…

872 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