Link to home
Start Free TrialLog in
Avatar of jtallsup
jtallsup

asked on

"MALFORMED GUID"

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.
Avatar of p_biggelaar
p_biggelaar
Flag of Netherlands image

Okay, can you post the query?
Avatar of jtallsup
jtallsup

ASKER

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.
I changed the field name in all the appropriate places just to be sure.
No help.
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'})
The name DOS is indeed NOT the problem, see my suggested answer.
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 .........'
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#
ASKER CERTIFIED SOLUTION
Avatar of p_biggelaar
p_biggelaar
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Excellent, thanks a bunch. The # format did the trick. So much for "SQL Builder"
you're welcome...