Solved

"MALFORMED GUID"

Posted on 2000-02-14
11
432 Views
Last Modified: 2008-02-01
vb6, access97. I have a datareport which works fine until I try to put a search criteria into a date field. {Criteria for other fields OK). The SQL statement generated by the SQL designer looks fine to me. (But I am a beginner.) When saving the ammended query, I get this message: "To retrieve information for this Command, the Command must be executed. You may need to specify input parameter values in the Paramter tabe before the command is executed. Execution may add to or modify data in the database." Have no idea what to do with the Parameter Tab. Ther are no options presented, and all is greyed out. When I save it anyway, the msg is "MALFORMED GUID in query expression....."   When running the program, of course, the report won't run, "Errors encountered".  When I remove the criteria, everything is fine once again. As I said, I am a newbie, so it may take a fairly detailed answer to do me any good. If anyone can get me out of this jam, I would truly appreciate it.
0
Comment
Question by:jtallsup
  • 7
  • 4
11 Comments
 
LVL 2

Expert Comment

by:p_biggelaar
ID: 2521970
Okay, can you post the query?
0
 

Author Comment

by:jtallsup
ID: 2522847
Sure, here it is: "SELECT ID, Patient, Provider, FinalBill, MyPmnts, Unpaid, DOS From Bills WHERE [DOS BETWEEN {d'1999-01-01'} AND {d'1999-12-31'}]

Any chance that my field name "DOS" has a problem being a reserved or protected term? If so, it only happens when a criteria is assigned, otherwise OK.
0
 

Author Comment

by:jtallsup
ID: 2522955
I changed the field name in all the appropriate places just to be sure.
No help.
0
 
LVL 2

Expert Comment

by:p_biggelaar
ID: 2522959
Don't use the square brackets!! ([]) They are used to tell the SQL engine you are referring to a field.

This would be okay:
SELECT ID, Patient, Provider, FinalBill, MyPmnts, Unpaid, DOS From Bills WHERE (DOS BETWEEN {d'1999-01-01'} AND {d'1999-12-31'})

or:
SELECT ID, Patient, Provider, FinalBill, MyPmnts, Unpaid, DOS From Bills WHERE (DOS BETWEEN {d'1999-01-01'} AND {d'1999-12-31'})
0
 
LVL 2

Expert Comment

by:p_biggelaar
ID: 2522984
The name DOS is indeed NOT the problem, see my suggested answer.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:jtallsup
ID: 2523379
No help, exact same error. Please check your previous, you seem to have offered me two identical options.
Futher info: WHERE DOS BETWEEN (1999-01-01) AND (1999-12-31) does not generate any errors, but also returns no records in the report. WHERE DOS BETWEEN (d'1999-01-01) AND (d'1999-12-31) results in a different error msg:
"Syntax error (missing operator) in
'DOS BETWEEN .........'
0
 
LVL 2

Expert Comment

by:p_biggelaar
ID: 2523529
There was nothing wrong with the brackets you used around the dates. Try this one:

SELECT ID, Patient, Provider, FinalBill, MyPmnts, Unpaid, DOS From Bills WHERE DOS between #8/10/1999# And #9/10/1999#
0
 
LVL 2

Accepted Solution

by:
p_biggelaar earned 100 total points
ID: 2523532
Or of course using your dates:

SELECT ID, Patient, Provider, FinalBill, MyPmnts, Unpaid, DOS From Bills WHERE DOS between #1/1/1999# And #12/31/1999#
0
 
LVL 2

Expert Comment

by:p_biggelaar
ID: 2523546
One more comment: the syntax you were using (the {d'DATE')} etc... bit) works in T-SQL, or SQL-server, but indeed not in Access97.
0
 

Author Comment

by:jtallsup
ID: 2523644
Excellent, thanks a bunch. The # format did the trick. So much for "SQL Builder"
0
 
LVL 2

Expert Comment

by:p_biggelaar
ID: 2523699
you're welcome...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now