Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • Last Modified:

Syntax issue with If then code

What is wrong with:  (the WHERE part of it must be wrong)

Me.txtSprayDate = Me.txtDatePlanted + Me.txtGR1 WHERE [PlantedID] = me.txtPlantedID
0
SteveL13
Asked:
SteveL13
1 Solution
 
Jim P.Commented:
Me.txtSprayDate = Me.txtDatePlanted And Me.txtGR1 WHERE [PlantedID] = me.txtPlantedID
0
 
SteveL13Author Commented:
Here is what I have but it doesn't work:

Me.txtSprayDate = Me.txtDatePlanted + Me.txtGR1 WHERE [ReadyID] = me.txtReadyID

Note that we need a plus mark not AND since it needs to add a number of days to the txtDate Planted
0
 
Jim P.Commented:
Is this in a query, VBA code on a form or what? A little context would help.
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
SteveL13Author Commented:
Form
0
 
IrogSintaCommented:
What's wrong with it it's that the keyword WHERE is used inside a query or a SQL string and not in the context you're using it in. What exactly are you trying to do?
0
 
GozrehCommented:
Like other says you can use WHERE only in a Query or SQL, not in middle of VBA

so you should change it to
Me.txtSprayDate = DLookup("DatePlanted + GR1","tbl","PlantedID=" & me.txtPlantedID)

depends what you need
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Tackle projects and never again get stuck behind a technical roadblock.
Join Now