variable coding help

Dim Divis as string
Dim strWhere as string

Select Case optDivision.value
  Case 1 
     Divis = "Property"
   Case 2
     Divis = "House"
   Case Else
     Divis = ""
End Select

StrWhere = " WHERE qryExpense.Status = ""Expensed"" AND qryExpense.Div = " & 
Divis  

I get a message box asking me to input House, when that is what I would like 
the criteria to be.

Any suggestions?
-- 
Teach me to fish!  Thanks for the help.
Pax, M
0
Utf
3/16/2010 12:28:01 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

1 Replies
735 Views

Similar Articles

[PageSpeed] 0

Hi m stroup,
try in this way

StrWhere = " WHERE qryExpense.Status = 'Expensed' AND qryExpense.Div = """ & 
Divis & """"

HTH Paolo

"m stroup" wrote:

> Dim Divis as string
> Dim strWhere as string
> 
> Select Case optDivision.value
>   Case 1 
>      Divis = "Property"
>    Case 2
>      Divis = "House"
>    Case Else
>      Divis = ""
> End Select
> 
> StrWhere = " WHERE qryExpense.Status = ""Expensed"" AND qryExpense.Div = " & 
> Divis  
> 
> I get a message box asking me to input House, when that is what I would like 
> the criteria to be.
> 
> Any suggestions?
> -- 
> Teach me to fish!  Thanks for the help.
> Pax, M
0
Utf
3/16/2010 1:03:03 PM
Reply:

Similar Artilces:

Area code overlay
I live in southern california where they have implemented a 310/424 area code overlay. I use outlook 2k to dial my contacts, but I cannot make outlook dial my local area code. Can anyone help? Phil M. You have to change your dialing rules here: Control Panel > Phone & Modem options > Dialing Rules tab > Highlight a location > Click Edit > Area Code Rules tab > Add a rule for your area code "torrbo" <pmaio@earthlink.net> wrote in message news:1153933870.933917.300640@h48g2000cwc.googlegroups.com... >I live in southern california where they have im...

Truncate Table Table variable
Hi, Sql Server 2005 I am using table variable with in a stored procedure and within a table variable i am using identity field. Sometimes I required to truncate the table variable to rseed the identity, but truncate table variable, dbcc checkident are not working. Any idea... Declare @Columns Table(id Int Identity(1,1), [Name] VarChar(155)); Insert Into @Columns([Name]) Select 'A' Union All Select 'B' Select * From @Columns Truncate Table @Columns Insert Into @Columns([Name]) Select 'X' Union All Select 'Y' Select * From @Columns Ra...

Global variables - again
Hi, When I load my first form in the system, it reads in the following parameters from my INI file. User Name the DOS Path to the Data I store these two value in a global variable and only reference them from that point on. I use the user name to read in a row from the tblUserParm table that has all of the settings for that user. I use the DOS data path to get to different sub-directories under my Access db directory. I will also use it to make automatically re-do my links, but I am not at that point yet. Is this an appropriate use of global variables? Is there...

Environment variables
Are Windows XP x64 %environment variables% available to Excel and VB equations? The general answer is yes, but you need to understand that there are different views of the filesystem and registry for 32-bit programs as compared to 64-bit programs and the OS. This also affects things like ODBC sources as well. -- Charlie. http://msmvps.com/blogs/russel <johnsuth@nospam.com.au> wrote in message news:c1.2c.3KklPW$0TR@PC1.BIGPOND.COM... > > Are Windows XP x64 %environment variables% available to Excel and VB > equations? > > ...

Please help #6
Hi, May I know how to create a variable that links to a cell? What I meant is I have a list that looks like this : indo : indo.xls sg : na.xls india : na.xls tw : na.xls thai : na.xls Is there are a in which I could make indo,sg,india,tw and thai as variable in which I could use for the entire book? in which will parse the value that is define by the user in this case the variable indo will pasrse me the value/string indo.xls Is it possible? Please help. Thanks in advance. Cheers, Howie --- Message posted from http://www.ExcelForum.com/ Choose Insert/Name/Defi...

TEMP environment variable
Hi, Does somebody know what happens when I write in the 'TEMP' environment variable more than one directory, seperated by a ';' (For example 'C:\windows\temp ; d:\temp')? Does the OSs (98, 2000, XP) know to use BOTH directories as a temporary directories? Regards, Ram ...

Object variable or With block variable not set
I'm trying to put a command button on a form using the command button wizard and I am getting this message "Object variable or With block variable not set". I cannot figure out what's happening. I tried opening different instances of Access and am getting the same problem with some but not all of my .mdb files. Hope someone can help. Thanks, Laura Laura Its hard to think what it would be with no example... did you edit the code generated by the wizard? or is it the wizard producing the error? Can you paste the code here? cheers Jeff "laura" <replyto@gr...

Access Control variable values in one PropertyPg from another Pro
hi all, i am unable to access the property page control values from another property page. // snippet of the code CPropertySheet dlg(_T("Hellow"), this, 0); one a; //First Property Page two b; //second Property Page three c; //third Property Page dlg.AddPage(&a); dlg.AddPage(&b); dlg.AddPage(&c); dlg.SetWizardMode(); dlg.DoModal(); //================================================ if the first property page contains the ComboBox with some values i am trying to acces the values in the second property page as one* m_Main2 = (one *) GetParent(); CString str; fo...

I can not get excel to print on front and back can anyone help me.
I can not get excel to print on front and back of a page. I tried setting it to duplex printing but that did not work. If there is not a way to do it then can I only print odd and even pages. If so then how? is your printer able to print front and back? See also http://www.rondebruin.nl/print.htm#odd -- Regards Ron de Bruin http://www.rondebruin.nl "damorrison" <davemcochrane@gmail.com> wrote in message news:1138752185.640199.294620@o13g2000cwo.googlegroups.com... > is your printer able to print front and back? > ...

Novice Question Help Please
I have two spread sheets with email addresses, sheet 1 has 10,000 addresses, sheet 2 has 25,000 addresses including the 10,000 on sheet 1. I need to remove the 10,000 names from sheet 2 leaving me with just the 15,000 unique addresses. Is there a simple answer? or at least is there a complicated answer? Thanks for any help One method....... Copy the 10,000 from sheet1 to sheet2 so you have the duplicates on one sheet. Then see Debra Dalgleish's instructions on how to extract unique records using Advanced Filter. Very simple process. http://www.contextures.on.ca/xladvfilter01.ht...

Recordset in excel with variables
I have successfully figured out how to retrieve data from a SQL server from within an excel sheet. The thing I can figure out is how I can use variables in that recordset from data in a particular cell. Example : Select * from inventoryAudit *that works currently in my sheet but I need to add a variable to the query Example : Select * from inventoryAudit Where transfer_dte Between varStart And varEnd * varStart & varEnd would be dates entered into 2 cells on the sheet, than a button would be pushed that would run the query and return the results into the sheet This is what I have...

How to automatically move to next field after Bar/EAN code entry?
Table Columns: EAN Code; Product Name; Order Qty Form Fields: EAN Code as a combo box; Product Name (No Tab stop); Order Qty. Question: The cursor is in the Cbo Box. I am using a Bar Code scanner to read the code from the sales packet which I want to order. The numercal bar code is located from the Cbo Box list and is selected. Using the "After Update" event procedure, the Product Name field then shows the product name related to that code. I would like to then manually enter the number of pieces I want to order into the Order Qty field. The problem is that the cursor r...

Relatively new to excel and I need help
This is what I need. I have data in let's say from A1:A200 I need that if I color which ever cell I choose from A1:A200, the cell next to it displays a text of my choosing. Example. If I select A5:A7 and color them Yellow, then B5:B7 will show the letter R. To get you in the picture, I need this so that when I'm doing a Bank Reconsiliation, when I highlight the cells I need (by using the yellow colour) in the cell next to it the letter R appears. Thanks Sub getcolorindex()'Fire after all colors entered On Error Resume Next For Each c In Range("a1:a200") Sele...

Variable instances
Hi, I just want to check that i have the correct understanding of the following premise. I have a Class , say Class A that i use as a base class for two other classes, say Class B and Class C. I declare instance sof each class as follows. ClassB p_BVar = new ClassB( ); ClassC p_CVar = new ClassC ( ); Each class inherits a member variable from the Base Class called bool bStatus; Now if i change this variable using p_BVar->bStaus = .... this change should not be relected in p_CVar since p_BVar and p_CVar are two separate instances and do not point to the same address. Is this a corr...

Please help
Perhaps too much new softwares installed this week. Now I am having a non-critical, but kind of annoying issue, I can continue working with it but if anyone could please comment? A typical Windows multiple-choice menu, e..g. drop down; for example right-click on empty desktop area and select View or Sortby, which in turn also lead to other menus. Or iun Internet zexplorer View-->textsize, zoom, etc. Or anywhere else. Upto today it was predictable - next menu subwindow would popup on the right side if there's space between it and display's rightmost edge (or on left ...

how to convert a CString variable to unsigned short array one?
Hi, In my unicode VC6 app, how to convert a CString variable to unsigned short array? ....... CString strRst; unsigned short strOleChars[100]; strOleChars = strRst; //??? Thank you. Is ConvertStringToBSTR() what you are looking for? AliR. "David" <David_Wang_Xian@hotmail.com> wrote in message news:e6gbA3avFHA.720@TK2MSFTNGP15.phx.gbl... > Hi, > In my unicode VC6 app, how to convert a CString variable to unsigned short > array? > ...... > CString strRst; > unsigned short strOleChars[100]; > strOleChars = strRst; //??? > > Thank you. > > ...

Referencing Variable Name Worksheets
I'm updating a formatted worksheet every day. I have a macro that processes, lets the user augment, and then saves that days data into a new worksheet with that days date. I need to reference that worksheet the next business day to error check. I cannot : PREVIOUS DATE IS IN CELL A1 s = range("a1").value worksheets(s).select Thank you for any help/suggestions Chris Cameron You might try sheets(1) sheet1 -- Don Guillett SalesAid Software donaldb@281.com "camerons" <camerons@epud.net> wrote in message news:117nvk3b9e8mg06@c...

Help saving email attachments.
Hello everyone I need some help. When I right click on an excel attachment and click save as I always have to type in the extension even though my file extensions are hidden. The save as type: is set to All files. The drop down menu does not have excel. If I open the file and click save as it automatically saves as an excel docment. Please help me correct this. I just formatted my computer and this issue was not present before the cleaning. Thanks in advance. -- TwEaKFrEaK ------------------------------------------------------------------------ TwEaKFrEaK's Profile: http://www.e...

Convert expression to code
Hi All, I have a conditional formatting expression i would like to convert to code, and need some help! I want the code to be in the OnOpen event of a report (called rptAllInformation). If the value of [DIA FORM ISSUED] is more than 6 weeks ago, and [DIA RESPONSE RECEIVED] is null, then label (lblOverdueWarning) becomes visible At the moment the expresson is: [DIA RESPONSE RECEIVED] Is Null And [DIA FORM ISSUED]<DateAdd("w",-6,Date()) Can anyone help? Kirstie "Kirstie Adam" <kirstiea@ecosse.net(nospam)> wrote: >Hi All, > >I have a conditiona...

Copying calender entries via code
Hi Is there a way to copy entries from a calendar in the public folders to the standard calendar via code ? A code example would be highly appreciated. If this code can run under a timer then that would be even great. Many Thanks Regards Try this macro, which will copy all of the selected items in the active Calendar to the default Calendar: Sub CopyAppointmentItem() Dim objNS As Outlook.NameSpace Dim objAppt As Outlook.AppointmentItem Dim objCopiedAppt As Outlook.AppointmentItem If ActiveExplorer.Selection.Count = 0 Then Exit Sub Set objNS = Application...

SQL help!
Can somebody tell me how to custom my price list report in SO and HQ so that i can turn on the Re-order number column? Its the re-order number that is in the supplier tab that i need to be availalbe on my reports. Thanks v much! Hi Philip, it is possible but make sure the following: ONe item attached to one supplier else report will repeat the same item twice/trice if the same item is purchase from mulitple supplier and you different kind of re-order no. However if one item is attached to one supplier then following query you can add in Items - Item Price List.qrp file to accompl...

Insert copied area help
Hi all, Looking for a way to insert an area copied from one worksheet into another worksheet - using a macro. We use Excel for payroll, and at the beginning of every pay period, I need to copy a blank payroll sheet and insert it into each of 12 employee worksheets. I can record a macro that will begin at an employees sheet, insert blank lines, go to the "MASTER" sheet, copy the blank payroll sheet, return to the "active" employees sheet and paste in the new blank payroll area. However, when I do that (as you probably have already guessed) all it EVER does is past a blan...

How to clear the "Recent Documents", with code?
Does anyone have any code that will save me the trip to 1. Start 2. Settings 3. Taskbar... 4. Advanced 5 Clear ? TIA Hi, You can P/Invoke to the shell function SHAddToRecentDocs in shell32.dll, parsing 0 to the pv parameter will clear the recent documents. Hope this helps Chris Taylor "SE Serrell" <foursuns@imbris.com> wrote in message news:OYDfmOHoDHA.1764@tk2msftngp13.phx.gbl... > Does anyone have any code that will save me the trip to > 1. Start > 2. Settings > 3. Taskbar... > 4. Advanced > 5 Clear > > ? > TIA > > Ooops, Sorry I t...

compiling unix code
dear group, i'm trying to compile code with visual C++ (visual studio 2003 dotnet). the code compiles fine on unix; would like for it to compile on vc++. first question: first, is there a gettimeofday() function on windows? i was under the impression that gettimeofday() is part of the POSIX specification and MS windows is a POSIX compliant operating system. shouldn't the function exist for vc++? second question: here's the top of my code: #define N 10 // Dimension of the matrices #define ITERATIONS 500 // Times to perform multiplication. #incl...

Select item from dropdown list, item code is displayed in cell
I need help with a spreadsheet problem. I created a timesheet for users to track their hours with an in-cell drop down for some of the values. Currently, an user is able to use the in-cell dropdown to select a time off code and the result is displayed in the cell. However, I would like to have the user to see the full-name on the in-cell dropdown, but have the abbreviated code display in the cell when selected. I have been unable to figure out how to do this, so any help would be great! I am trying to stay away from extra Excel components or macros, as I like to keep this sheet easy for the e...