Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 10-26-2019, 06:20 PM   #1
VSolano
Newly Registered User
 
Join Date: Feb 2017
Posts: 75
Thanks: 7
Thanked 0 Times in 0 Posts
VSolano is on a distinguished road
Where Condition with multiple value

I will gladly apricate any help from this forum regarding this code.
I am passing various value from one from to another. The first part of the SQL works fine by when I adding another value it does not work. I tried the value with a variable and still I get the mismatch.

Code:
Private Sub Form_Open(Cancel As Integer)
Call taskschedule
Me.AllowEdits = False
Dim SQLDataSource As String
Dim STWhere As String
Dim Benf As Integer
 
Benf = Forms!frbillingtest!benefitsid
 
    SQLDataSource = " SELECT * FROM tbtaskschedule WHERE TaskAssignedTo = " & TempVars![SYSID] And TaskBenefitID = "  & forms!frbillingtest!benefitsid  "
    
    
    
    Me.RecordSource = SQLDataSource
    Me.Requery
End Sub

VSolano is offline   Reply With Quote
Old 10-26-2019, 06:25 PM   #2
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,399
Thanks: 13
Thanked 4,125 Times in 4,057 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Where Condition with multiple value

This may help:

http://www.baldyweb.com/ImmediateWindow.htm

A type mismatch is usually because the field's data type doesn't match how you've handled it. Generally speaking, text data types need apostrophe delimiters. This may help with that:

http://www.baldyweb.com/BuildSQL.htm
__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 10-26-2019, 06:40 PM   #3
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,569
Thanks: 68
Thanked 2,745 Times in 2,630 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Where Condition with multiple value

SQLDataSource = " SELECT * FROM tbtaskschedule WHERE TaskAssignedTo = " & TempVars![SYSID] & " And TaskBenefitID = " & forms!frbillingtest!benefitsid

__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
VSolano (11-02-2019)
Old 10-26-2019, 06:49 PM   #4
VSolano
Newly Registered User
 
Join Date: Feb 2017
Posts: 75
Thanks: 7
Thanked 0 Times in 0 Posts
VSolano is on a distinguished road
Re: Where Condition with multiple value

This is great information but I could not figure out the problem with my SQL

VSolano is offline   Reply With Quote
Reply

Tags
where condition

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple condition abshmo5 Modules & VBA 6 07-10-2018 11:43 PM
[SOLVED] Multiple WHERE condition richardw Modules & VBA 11 02-19-2016 07:51 AM
Sum IIF with Multiple Condition maabbas General 6 06-06-2014 04:30 PM
Multiple condition query accessma Queries 7 02-05-2008 06:52 AM
Multiple condition IIF SalesOpsSolutions Queries 5 11-13-2007 02:46 PM




All times are GMT -8. The time now is 07:50 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World