Using 'like' in a form query

I want to have my Office symbol query using 'like c* or c%' , using wildcards 
like you can do in a query... this works but I can't use wildcards with it... 

DoCmd.OpenForm stDocName, acFormDS, , "[group]= '" & strGroup & "'" & "AND" 
& "[office_symbol]= '" & "like" & strOffc & "'"
10/19/2007 2:02:01 PM
access.formscoding 7493 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 6

Your opening single quote is in the wrong place.

Rather than

& " [office_symbol]= ' " & "like" & strOffc & " ' "

it should be

& " [office_symbol]= " & "like ' " & strOffc & " ' "

Actually, you can simplify what you've got to

DoCmd.OpenForm stDocName, acFormDS, , "[group]= '" & strGroup & _
  "' AND [office_symbol]= like '" & strOffc & "'"

Exagerated for clarity, that's

DoCmd.OpenForm stDocName, acFormDS, , "[group]= ' " & strGroup & _
  " ' AND [office_symbol]= like ' " & strOffc & " ' "

Doug Steele, Microsoft Access MVP
(no e-mails, please!)

"Maarkr" <> wrote in message
>I want to have my Office symbol query using 'like c* or c%' , using 
> like you can do in a query... this works but I can't use wildcards with 
> it...
> help?
> DoCmd.OpenForm stDocName, acFormDS, , "[group]= '" & strGroup & "'" & 
> "AND"
> & "[office_symbol]= '" & "like" & strOffc & "'" 

10/19/2007 2:18:44 PM
"Maarkr" <> wrote in message
>I want to have my Office symbol query using 'like c* or c%' , using 
> like you can do in a query... this works but I can't use wildcards with 
> it...
> help?
> DoCmd.OpenForm stDocName, acFormDS, , "[group]= '" & strGroup & "'" & 
> "AND"
> & "[office_symbol]= '" & "like" & strOffc & "'"

The syntax should be:

    "[office_symbol] LIKE '" & strOffc & "'"

Carl Rapson

10/19/2007 2:19:25 PM

Similar Artilces:

Trying to get filtered Report based on form combo box
I submitted a question about making a form and combo box act like a parameter query a couple of weeks ago. Someone gave me some help but I still can't get it to work. The combo box is linked to the proper list but when I run the report I am having two problems. 1. THe report is not being filtered like I want. 2. I can't get it to preview, it keeps trying to print. Here is the code I have (minus all of the variations I have tried): On Error GoTo Err_CmdRunRpt_Click DoCmd.OpenReport "RptProgramInventory", , , "[ModelNo] = '" & Me.ProgramCombo &...

Adding custom pages to Windows Control Panel using MFC
Hi, Is there anybody know how to add a custom page to Windows Control Panel using MFC? I found some code on Internet but that was written in Win32 API. Also tried to find the material on MSDN but the content is pretty old (if I am correct) : Thanks. Is this what you're looking for? Tom <> wrote in message > Hi, > > Is there anybody know how to add a cus...

form fill templates
Im setting up a new form fill template and am having some trouble with the fill n boxes. Is there a way to set the font, text size, etc for them that I can apply to all of the boxes at once, or do i have to set them up individually? The fill boxes need to be different font then the questions. Also, is there a way to set the length of the response allowed so that answers do not ramble on, and that once the question is answered the respondee can easily tab to the next answer box/ thanks for any and all assistance! -- pete Run a macro containing the following code before you ...

Hello, I've seen some posts regarding a similar problem to what I'm having but cant find the resolutution! I have a database with tableA which contains basic inventory info. I have a field in tableA named location. There is a second table (tableB) which has a list of all the locations our company delivers to. I've been warned to stay away from lookup fields, so I'm using combo boxes on the form to look up the location and then populate the location field in tableA when the value is selected. Here is the issue (and again, I've found some posts similar): Running a...

Erratic behaviour when rapidly scrolling through form records
I am developing an Access 2003 application associated with a photographic competition. My ScoringForm permits the selection of image classes and a subform displays all the images in the selected class. This subform is bound to a query and contains an option group of 14 buttons - each button representing one of the possible scores to be awarded during the judging process. If an image has been allotted a score, then the text on the selected button (and only the selected button) is made bolder and has its colour changed from black to red. This makes the chosen score stand out very clearly...

Access Mulit users in form keep stumbling over each other
I've got a front end Access database that has the form and a backend Accessdatabase that has the data. I would like mulitple users to be able to enter information into the form but they keep stumbling on each others work when they are doing so. My database is very simple, the table has 2 columns one has the account number of customers and the other is where the workers will fill in Yes or No. The users open the form copy the account number, enter it into a program, and review it. If they account is positive for what they are looking for, they mark yes or no and go onto the next record....

Chart using Macro
I have several sheets having similar data for different lanes. I have a macro which can create a graph I want with different series plotted in different forms for source data on a particular sheet. I want to be able to create a graph for the active sheet. How do I use ActiveSheet data as source data for the gaph. ...

Query 08-24-07
I have two tables. One contains contigent employees the other full-time employees. I would like to create a query that combines these two tables, so the contigent and full-time employees are all on one report. How can I accomplish this? Thanks for your help Is there a business reason these two tables are kept separated? For instance, the data elements you keep about "contingent" employees differs from the data you keep about "full-time" employees? If you have two identical tables (same structure), one for each "type" of employee, your data is structured ...

Query to Access : does'nt see tables
Office 2000 SP3 FR From Excel / MS Query, I want to read data in Access tables. I choose the mdb file and so MS Query displays this error message (translated) : "This data source does'nt have any visible table". Original in French : "Cette source de donn´┐Żes ne contient aucune table visible." I transfert my data to a new mdb file : it work's few times (!), then the error message appears again. How to resolve this problem ? Jacques. Gotcha ! MS Query does'nt accept a file name with 2 dot inside ! Example : MyFile.mdb --> Ok My.File.mdb --> "...

I have changed my default mail program from Microsoft Outlook to Outlook Express but emails are still going into Microsoft. How do I make them go into Outlook Express? Any help much appreciated.... On Aug 19, 12:35=A0pm, "Ron Head" <> wrote: > I have changed my default mail program from Microsoft Outlook to Outlook > Express but emails are still going into Microsoft. =A0How do I make them = go > into Outlook Express? =A0Any help much appreciated.... You would have to set the account up in Outlook Express as well. Changing the default email ...

how to use RichInk control for Mobile word
Hi all, I am trying to view the word documents in Pocket PC. I got some MFC code in the following link. It is doing well for reading Pocket PC 2003 word document (.psw). I tried this to read Mobile word ( Word document for WM 5.0).It showing some same invalid data for any input. If anybody has idea on it please help me.. Thank you, Supriya. ...

End Program Hanging...after using Money Deluxe
After using MS Money Deluxe, Win XP, All files are current and up to date : When I close Money and want to shut the computer down I get a message pop up, End Program : 5A25A898 THAT HANGS, Then I get another END PROGRAM: MCI Command Handling. Then I invoke Task Manager to end all tasks and the computer shuts down. Any suggestions. Thanks In Advance In, Birdflu wrote: >After using MS Money Deluxe, Win XP, All files are current and up to date : > >When I close Money and want to shut the computer down I get a message pop >up, End Program : 5A25A898 THAT...

Add more than one series to a pivot chart using VB MS Access continued...
I'm trying to programmatically create a stacked bar pivot chart. Using "Programming Microsoft Office Access 2003" by Rick Dobson, I've created the chart. However, it doesn't distinguish between the different values for the series. Does anyone have any suggestions on how to create a chart using one column containing three values for the series? Essentially, this is a continuation of a previous post:" Any help is greatly appre...

Relaying using AUTH
Someone had guess a weak password on one of my user accounts, and was using this with the AUTH command to relay messages off my Exchange 5.5 IMC. I enabled protocol logging, and saw the AUTH commands, and tracked down what account they were using with a base64 decoder and disabled the account. Now I want to find out what IP address these were originating from so I can repay the SOB. However, the protocol log only has hostnames where it says "accepting connection from". and the host names are bogus. I tested it, and it logs whatever you have entered a...

UNION query taking 5 minutes for approx 2000 records
I am dealing with data from two hospitals, each with their version of the database. I am trying to group records of admissions and discharges from each hospital by patient (URN), date of admission (DOA), date of discharge (DISCH) and time of admission (TOA) where at least one patient record represents a transfer from hosp A (KEMH) to hosp B (PMH) ie where demogr_urPM.ADMIT_SOURCE Like "KEMH*". The individual SELECT queries run quickly enough but the UNION query I am using takes approx 5 min to return about 2000 records. The source tables, demogr_ur (for hosp A) and demogr...

Set Form height at Runtime Access 2007 Runtime
I want a fixed number of records in my detail section no matter the size of the window. I put: Form.Section(acFooter).Height = Me.InsideHeight - (Form.Section(acHeader).Height + numrows * Form.Section(acDetail).Height) in my load event code. It works great when I am running the development code, but when I run it in runtime the detail height is at the default height. Any ideas? Thanks OK --- more information ---- When I put a ribbon on the form all is well. How can I figure out if there is a ribbon displayed while in runtime? In a .accdb file there is always a ...

More info on my Microsoft Query problem.
I am using Microsoft Query to extract data from one Excel file to another. The query is set to return all the information for one specic order number. It does successfully return all the information except for the information listed under one of the columns. It lists and see the column but does not return the actual informmation. More specifally, it is the item price. Item price is written at the top of the column but the actual pricing is not extracted. And I went into Microsoft Query help and followed the instructions. The file is closed, and the data is formatted the same way. A...

using the time structure with MFC
Hi, Coming from C, how could I translate this into MFC based code (using CString)? char szTime[65], szDate[65]; time_t t = time(0); struct tm* tm = localtime(&t); strftime(szDate, 64, "%Y%m%d", tm); strftime(szTime, 64, "%H%M%S", tm); CString strTime, strDate; Thanks CTime Time = CTime::GetCurrentTime(); CString strDate = Time.Format("%Y%m%d"); CString strTime = Time.Format("%H%M%S"); AliR. "markww" <> wrote in message news:1156883820.948360.39250@m79g200...

Excel Automation using in VC 2005
Hi all, I am doing excel automation using MFC in VC 2005. It is just a simple program to just open an excel sheet nothing more than that. I have followed steps describerd in this link: But when i build the project it is giving following errors, Can any body tell why it is happening like this..? Errors: error C2371: 'FontPtr' : redefinition; different basic types error C2786: 'BOOL (__stdcall *)(HDC,int,int,int,int)' : invalid operand for __uuidof error C2923: '_com_IIID' : 'Rectangle' is not a valid template type arg...

Append Query 09-13-07
I have and excel spreadsheet I import into a table every week. I wrote this append query to append this table to a datasheet in access. It works except I want to only add the new rows where there is a new router. The impRouter is the key field. It should be in SQL NOT EQUALS TO??? query that appends all the records INSERT INTO _HSIImport ( impArea, impHeadend, impRouter, impDate ) SELECT [Port History9_1_2007].Area, [Port History9_1_2007].Headend, [Port History9_1_2007].[Element Name], ([#date#]) AS Expr1 FROM [Port History9_1_2007]; modified query to add only the new router records...

email attachment(s) from query results
Through a series of forms and queries, my users select a list of pdf files that should be sent via email. This list might contain anywhere from 1 to 20 pdf's, and the actual files and number of files vary with each use. At this point, this list is emailed to someone who manually creates an email with the appropriate attachments. This is not a terribly efficient workflow. Already existing in the database, I have a hyperlink field containing the full path to each of the pdf files. What I'm looking for is some way for access to loop through the final query results, retrieve the...

How to use C# DLL in MFC
Hi all, I developed one C# DLL. now i want to use that DLL to my MFC application created using vc++. Can any one help me how to load those DLL's.... Thanks in advance, SaranG SaranG(Saravanan) wrote: > Hi all, > I developed one C# DLL. now i want to use that DLL to my MFC > application created using vc++. Can any one help me how to load those > DLL's.... > > > Thanks in advance, > SaranG > > I think you could do that through COM interop. Regards, F. Firstly, this is the wrong newsgroup for this question...anyways... you can ...

How do I get certificates to use to send from email addresses???
Everything seemed to go well in setting up email addresses in outlook. They tested fine and I have no problem receiving messages in outlook. The problem comes when I try to send messages .... and I've tried sending from outlook using each and every email address I've set up. This is the message I get: "Microsoft Outlook could not sign or encrypt this message because you have no certificates which can be used to send from the email address" I've tried going to sites and downloading certificates. They don't seem to appear in outlook??? A...

Order form to BOL?
I'm not exactly a novice with Excel, but there are quite a lot of functions I haven't yet needed to use in the various positions I've held. What I'm trying to do now is very, very different from anything I've done before, so I hope this is the proper forum. I have been handed the opportunity to redesign the processes by which our Traffic office runs. What I would like to do is create an Excel order form, which could then be used to automatically generate a Bill of Lading. I will need to pull specific data entered by the customer in the form to a template worksheet in the ...

Message box warns for duplicate use of named ranges when copying s
I created an Exel/VBA2003 application in which a copy of a worksheet is added when the user pushes some button on the main form. In the worksheet which is copied, I use a few named ranges. This works fine in 2003. In 2007, however, a message box pops up that warns for duplicate use of the named range in the new sheet. Since there are 5 ranges, it is quite annoying to cancel these message boxes every time. Can I programmatically prevent these msg boxes from popping up ? Thanks ! Found one answer on pcreview (gracias a Hector Miguel): add Application.DisplayAlerts = False a...