UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Select Query With A Text Value As Criteria, Access 2010    
 
   
SemiAuto40
post Dec 8 2017, 12:23 PM
Post#1



Posts: 459
Joined: 3-April 12
From: L.A. (lower Alabama)


What is wrong with this? At this point I get a "too few parameters expected 1" error.
CODE
Dim NewRecord as long
Dim strSQL as string
     strSQL = "SELECT MAX([Method_ID]) AS NewRecord FROM " & "tbl_Methods" & " WHERE [Method_Title] = " & "'" & Me.Method_Title & "'" & ";"


Me.Method_Title is a string control on frm_NewRev.

Thank you.
Go to the top of the page
 
theDBguy
post Dec 8 2017, 12:27 PM
Post#2


Access Wiki and Forums Moderator
Posts: 71,229
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Maybe double-check your spellings for Method_ID and Method_Title.

Just a thought...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
SemiAuto40
post Dec 8 2017, 12:42 PM
Post#3



Posts: 459
Joined: 3-April 12
From: L.A. (lower Alabama)


You are a psychic! How did you know that my select max field had an 's' at the end of it which was missing?
Now that is fixed the error is "syntax error (missing operator) in query expression '0WHERE tbl_Methods.Methods_ID = 379'"

That I don't understand because clearly my WHERE criteria is Method_Title.
Go to the top of the page
 
theDBguy
post Dec 8 2017, 12:44 PM
Post#4


Access Wiki and Forums Moderator
Posts: 71,229
Joined: 19-June 07
From: SunnySandyEggo


Repost the new code or trace it to see where the problem is.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
SemiAuto40
post Dec 8 2017, 01:09 PM
Post#5



Posts: 459
Joined: 3-April 12
From: L.A. (lower Alabama)


blush.gif My apologies complete with embarrassment! I had SQL code right below the problem spot which looked similar - and THAT is where the problem is.
Thank you for your gift of time to help. thanks.gif
Go to the top of the page
 
theDBguy
post Dec 8 2017, 01:12 PM
Post#6


Access Wiki and Forums Moderator
Posts: 71,229
Joined: 19-June 07
From: SunnySandyEggo


Hi,

No worries. Glad to hear you got it sorted out. Good luck with your project.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    15th December 2017 - 08:44 AM