Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with the m_strFilter

Status
Not open for further replies.

Larree

Programmer
Dec 31, 2002
20
SG
Hi all,

I am using ODBC for my program. I want to specify a filter for the records in my MS access database. When my code for performing teh filter is as follows:

m_ParticipantSet->m_strFilter = "PartName = '" +
dlg.m_PartName + "'";

The filter is successful. However when I want to change the filter to :

m_ParticipantSet->m_strFilter = "ID Number = '" +
dlg.m_IDNumber + "'";

an error is generated when I run the segment of the program which reads " Syntax error (missing operator) in query expression 'ID Number = 77234612" " where 77234612 is the value entered by the user in dlg.m_IDNumber
It is something wrong in my MS access database that I must set to be able to successfully filter the required records? Or is there something wrong with my filter string? Please advise....Thanks
 
Larree,

If “ID Number” column is a numeric type you don’t want the value surrounded by quote characters just the number value

Code:
ID Number = 12345

-pete

 
Hi,

The database field format that I have used for ID Number is text. However when keying in the value for dlg.m_IDNumber, it contains numbers. Is this ok? Or do I have to switch to integer format in the specification for the database field format. However if I switch to integer, then it s not possible because the input from the user contains a mixture of text and numbers. A typical ID Number is like G2345168K. However if I remain it as text, the syntax error (missing operator)in query expression ' ID Number = G2345168K " will still persist.....please advise....thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top