How do I concatenate a text field from a form to a "Where" string ?

Hi

In the following, "id_Part" is a text field in a report.
Me.txtPart is a field on my input form.
strWhere is the condition for opening the report.

How do I concatenate the Me.txtPart so it is text (surrounded by
single quotes)
in the strWhere ?

In other words, I want the strWhere string to evaluate to the
following:

id_Part = '95405' (where 95405 is what is entered on the form)

    Dim strReport As String     'Name of report to open.
    Dim strField As String      'Name of your date field.
    Dim strWhere As String      'Where condition for OpenReport.
    Const conDateFormat = "\#mm\/dd\/yyyy\#"

    strReport = "Sales History Inquiry3"
    strField = "is_Date"
    strField2 = "id_Part"

    If IsNull(Me.txtStartDate) And IsNull(Me.txtEndDate) Then
            strWhere = strField2 & " = " & Me.txtPart
    End If

I hope I made this clear.
Thanks in advance

Mark

0
mthornblad
9/10/2007 7:40:26 AM
access.forms 6864 articles. 2 followers. Follow

1 Replies
1292 Views

Similar Articles

[PageSpeed] 47

Hi Mark,

The line shoud look like this:

             strWhere = strField2 & " = '" & Me.txtPart & "'"
         
             'for debugging
             msgbox strWhere 


Here it is expanded for ease of reading: (don't use this, use the one above)

  strWhere = strField2 & " = ' " & Me.txtPart & " ' "


HTH
-- 
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


"mthornblad@gmail.com" wrote:

> Hi
> 
> In the following, "id_Part" is a text field in a report.
> Me.txtPart is a field on my input form.
> strWhere is the condition for opening the report.
> 
> How do I concatenate the Me.txtPart so it is text (surrounded by
> single quotes)
> in the strWhere ?
> 
> In other words, I want the strWhere string to evaluate to the
> following:
> 
> id_Part = '95405' (where 95405 is what is entered on the form)
> 
>     Dim strReport As String     'Name of report to open.
>     Dim strField As String      'Name of your date field.
>     Dim strWhere As String      'Where condition for OpenReport.
>     Const conDateFormat = "\#mm\/dd\/yyyy\#"
> 
>     strReport = "Sales History Inquiry3"
>     strField = "is_Date"
>     strField2 = "id_Part"
> 
>     If IsNull(Me.txtStartDate) And IsNull(Me.txtEndDate) Then
>             strWhere = strField2 & " = " & Me.txtPart
>     End If
> 
> I hope I made this clear.
> Thanks in advance
> 
> Mark
> 
> 
0
Utf
9/11/2007 5:38:00 AM
Reply:

Similar Artilces:

Search Form Result to excel - Item not found
Hi, I have a search form and have been given the task of getting the searched filtered records to an excel spreadsheet. I am getting "Item Not Found In This Collection" and do not know where to start to find the reason. I have taken the following and adapted from another working similar application. ' this is to send the forms results to an excel spreadsheet Dim dbsCurrent As DAO.Database Dim qryTest As QueryDef Dim SQL As String Dim QueryStringSelect As String Dim QueryStringFrom As String Dim QueryStringWhere As String 'output filtered data if some filter...

Where is the Keep Text Formatting feature located in Word 07
I believe this Keep Text Formatting feature might be what I need, but I have been unable to locate exactly where it is located in Word 2007. I'm trying to rid a Word document sent to me of tables, text boxes, graphics and all other document formatting, while retaining the document's text content. It is unimportant to me whether the text formatting is retained or not. Thanks. Are you referring to a Keep Text Formatting feature in an earlier version of Word? I wonder whether what you're looking for is "Paste Unformatted," since you seem to be saying you _don...

where do I find small tearoff order form template for Publisher
I am doing a newsletter for our nonprofit organization and I need a half or 1/3 page tear off template order/bdonation form I can include. I am using Publoisher 2003 Might look at the built-in Publications for Print. There are flyers with tear-offs and special offer flyers with forms. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "guatdoc" <guatdoc@discussions.microsoft.com> wrote in message news:6CBFC08A-594C-40B6-9514-96F586E56D70@microsoft.com... >I am doing a newsletter for our nonprofit organization and I...

find entry where id doesn't have a certain entry in another field
I need help with a query. In a table each id can have more than one output_device, but must have at least an entry for 'RECS'. How can I identify id's that don't have an entry where output_device = 'RECS'? Example, id of 567 is ok, but I want to get id 459 because it doesn't have an entry for RECS: id output_device 567 RECS 567 IA3 459 IM7 459 TR4 Thanks for any ideas! SELECT DISTINCT A.id FROM [your_table] AS A LEFT JOIN ( SELECT DISTINCT id FROM [your_table] WHERE output_device = 'RECS') AS B ...

How do I stop lines of text breaking where I don't want them to?
>> Mr Devlin asked Sen-Sgt Hurley if he was aware that (police procedural) >> rules >> clearly prohibit officers (involved in any incident to be investigated) >> from talking >> among themselves because it may contaminate evidence. How do I make the lines wrap correctly? If you click on the Show/Hide (¶) button and it reveals a ¶ after the words "rules" and "talking", See the article "Cleaning up text pasted from the Web” at: http://www.word.mvps.org/FAQs/Formatting/CleanWebText.htm -- Hope this helps. ...

Where is the field that holds the total time for a case?
All, I am trying to pull the value for total time from the CRM database for a case. I want the value that shows up in the resolve pop-up as total time (time entered in the activities of a case). Also would like to find the billable time. Have a great day, Barry The method you want is incident.calculatetotaltime which is documented in the SDK. Hope that helps! Graham "Barry" wrote: > All, > I am trying to pull the value for total time from the CRM > database for a case. I want the value that shows up in > the resolve pop-up as total time (time entered in t...

show only fields where data is inside access 2002
Hello, is it possible to generate a report where only these fields are shown, in wich data can be found? I have a large table and everyone has somthing in another colum. so if i make a report i have all the coloums in there but only need some of them. please excuse my english ( if this is english at all) Peter If you set the Can Shrink property of a text box in your report, it will take up no vertical height in the report when the field is Null. It only works if there is nothing else beside it (overlapping it vertically.) Typically you have a label beside it, and so the label prevents ...

Where can I find the Text Import Wizard?
Hi, I have some files I want to open in Excel (2000). The files contai text and numbers, separated by delimiter "|". If I open them in Excel I don't get the Text Import Wizard and I can't define the delimiter All the information is pasted in column A. The only way I can get the information separated in the right way, i by using Data -> Get External Data -> Import Text File. That way, th Text Import Wizard is launched and I can choose Delimited/Fixed Widt and the delimiter. Does anyone know how I can get the Text Import Wizard to launch when open the file with File ...

Field Service Anywhere: User Defined Fields/Labels
The 5 User Defined Fields should be setup to pull field lables from GP Field Service so that if you label the field in GP Field Service it reads the same way in FSA. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/N...

square prints where text box is but ...
Hi I have a text box in a document. It does not have a border/line on it. The first time I print its fine. The second time I print it or any other similar document, it prints with a square where the text box is. The text in the box is there too, but its printing the line around the text. I can't figure out why it does it fine the first time but every time after, it prints the line. Please help. Patty -- You can always teach an old dog new tricks. I know I don''''''''t know everything. Is this with a particular document, only, or can y...

Where in HQ do we set caption text for Customer Additional Tab?
I have scoured the documentation and can't seem to find it. Where can I set the captions for the fields on the Customer Additional Tab? I have set then in the Customcaption table to what I need, but I would still like to know where the heck I can set those from within HQ Manager. -- RMS 1.2.0.171 1 HQ 23 Stores in 9 states 145 Lanes This is a multi-part message in MIME format. ------=_NextPart_000_03D8_01C6E179.3C0CC4C0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Butch, Sorry, no option to do that. I think that Retail Realm = ww...

Field Service Anywhere Users ?
Looking the FSA product option and would like to get some insight from any current users of the product. Please respond if you would like to share your thoughts and experiences. My 2 cents: Installed and tested on only 1 device, so definitely NOT a thorough test. We used Palm 700wx phone for the test. Performance: VERY sloooooowwww. Don't know if it is our network here (we don't have EVDO) or the program or the device. This has been a very problematic device for us, so wouldn't be surprised if it is partially to blame. As an aside, if anyone is considering getting thes...

Create a field where a new number appears when the form is opened
I am trying to create a field that will have a number and I want to set that field to have the number change each time the form is opened. Each form must have a unique number. I know how to do this with a date field but figure out how to do this when the field just contains a number. Any ideas? Have you looked at the DMax() function? Morgan wrote: >I am trying to create a field that will have a number and I want to set that >field to have the number change each time the form is opened. Each form must >have a unique number. I know how to do this with a date field but fig...

how can I choose part of the text in a cell and paste it elsewhere
Hi, I have a cell with text : "AAAA_BBBBB" and I would like to have a code that copies the text in front of "_" and pastes it in the cell above. Can someone tell me how to do this?? Thanks! Hi, are you talking about Excel? this group is for Access questions -- Best regards, ___________ Alex Dybenko (MVP) http://accessblog.net http://www.PointLtd.com "Ksenija" <Ksenija@discussions.microsoft.com> wrote in message news:2E8E7CFA-FA2F-4ABD-9D1F-236241AFE5B6@microsoft.com... > Hi, > > I have a cell with text : "AAAA...

Where to change my own internet adress in "FROM:" field?
I am using Outlook 2003 with Exchange server. My own eMail address is presented to recipients as Aaaaa.Bbbbbb@ccccccc.com Note: mixing of capital and lower letters I want my email address completely changed to lower letters: aaaaa.bbbbbb@ccccccc.com Where in Outlook can I change this? or is this a setting in Exchange Server ? Joe This is a setting in ADUC/Exchange. I would guess that everyone is set up with the same format throughout the company. -- Kathleen Orland - MVP Outlook Outlook Tips: http://www.outlook-tips.net/ http://www.howto-outlook.com/ "Joe deAngelo" wr...

Form & where Condition Macro
I am using 2007 access (OS=XP). I designed a form in my database that works as a homepage. It basically pulls summary of everything about a patient from various tables. The homepage has multiple sub-forms and tabs that leads to other subforms all joined by PatientID. Each time a patient comes in for a visit, the homepage will act as a summary for that date of visit. So far so good! However, when I created the search for this homepage, my where condition is (="[PatientID]=" & [PatientID]). Now I want the homepage to only open the Date of Visit selected. I tried to ...

Where are the Forms and Queries in 2007
In Access 2003 if you wanted to open your existing Forms and Queries you clicked on the Forms button. In Access 2007 this option seems to be missing. My question is how do I access the Forms,Tables and queries. The only forms button I have found creates new forms, I want to access my existing forms. Many thanks for any advice. This is one of those times when a picture paints a thousand words, so here's a picture ... http://brenreyn.brinkster.net/navpane.jpg -- Brendan Reynolds "Ernmander" <Ernmander@discussions.microsoft.com> wrote in message news:4CDA479B-BFA6...

Can I set exactly where the catalog merge field repeats on the pag
Or at least maniputlate it a little? I have created a template for photo ID cards, 2 across, 5 down = 10 records per page. I can not get the catalog merge to lay over the top of my template in exactly the same place on each card. I want to overlay Name, Member number and their photo on each card, one person per card. The cards are equally spaced on the screen, the mail merge is overlaying 2 across, 5 down, but not on the same lines. If I increase the size of the merge field, it gives me fewer fields per page. Right-click the picture, format picture, layout tab, change the inline to exac...

Query for Single Field Value Where Another Field is at it's Max
I have a table called tblCompletedMessages which gets updated information constantly from my department. A new row with the latest information is added every few minutes. I would like to be able to query the value of a field called "PctOfStd" where the time field "TimeCompleted" is at it's maximum for a given date (the date is selected from a calendar control on a form) so that I will have the most recent PctOfStd for the date. I thought this would be pretty easy, but I can't get it to work. Any input would be appreciated. Steve Not sure what contex...

Count records from form where txtbox="ABC"
Hi everyone, I would like to have the total count of records from my form where in Field1, the value is "ABC" for exemple -- Thanks, Sorry if my english isn''t correct, but I''m from Potugal ;) Emanuel Violante Galeano On Mon, 28 Jan 2008 07:54:02 -0800, Emanuel Violante wrote: > Hi everyone, > > I would like to have the total count of records from my form where in > Field1, the value is "ABC" for exemple Add an unbound text control to the form. Set it's control source to: =Abs(Sum([Field1]='ABC'")) -- Fred Please res...

Where are Form Fields Stored
When I add a field to a form Using CRM form editier, where does it add the data thta represent the field being added to the form? Do you mean the information used to render the field on the form or the actual data? The data will be stored in a table like contactextensionbase...ie any fields you add to the contact entity are stored in contactextensionbase rather than contactbase. this is different than crm 1.2 which stored custom fields in contactbase ======================= John O'Donnell Microsoft CRM MVP http://codegallery.gotdotnet.com/crm "Hotwheels" <Hotwheels...

Assign a range to where the User Form places data
I have a user form with several text boxes and list boxes. I am having difficulties getting the data to be put in the right range. It goes to the next unused line and uses that line, however, there are couple lines at top of spreadsheet, so it uses those, instead of starting on line 4 as I would like. I have tried to select a range in which the lines are to be written, but not getting good results. Undoubtedly there is an easy answer. Thanks in advance for your attention. Hi As always post your macro for comments. Try and see if this can help you: TargetRow=3DRange(...

know where I can find an employee evaluation form, for free?
I want to develop employee evaluation procedures. I can't find seem to find any templates for it. Any ideas?? Thanx! ...

Do you know where I can find a template for a Client Inquiry Form
I am a novice user of Microsoft products so if the answer to my question is obvious please excuse me. I am using Microsoft Publisher 2002 (with SP3), I am trying to set-up a small business from home and want to be able to e-mail a client enquiry from to any potential clients. Is there a template available to download for Client Enquiry Form that I can use with Publisher 2002? Thanks Might adapt one these http://office.microsoft.com/en-us/results.aspx?Scope=TC&Query=inquiry -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com &q...

How do I concatenate a text field from a form to a "Where" string ?
Hi In the following, "id_Part" is a text field in a report. Me.txtPart is a field on my input form. strWhere is the condition for opening the report. How do I concatenate the Me.txtPart so it is text (surrounded by single quotes) in the strWhere ? In other words, I want the strWhere string to evaluate to the following: id_Part = '95405' (where 95405 is what is entered on the form) Dim strReport As String 'Name of report to open. Dim strField As String 'Name of your date field. Dim strWhere As String 'Where condition for OpenReport. ...