Variable field names?

Hi

I am trying to execute the following code: -

strSQL = strSQL & Nz([" & strCOM_Year & "], 0)

where strCOM_Year is a string I want the system to use as a field
name. It doesn't like this. Keeps saying 'can't find the field "|"
referred to in you expression', even though I can clearly see in the
debug window that the current value of strCOM_Year is "2006/2007".
i.e. I am looking for the value in the field called 2006/2007.

Any ideas?

Stapes

0
Stapes
6/10/2007 12:35:47 PM
access 16762 articles. 2 followers. Follow

3 Replies
858 Views

Similar Articles

[PageSpeed] 37

Stapes wrote:
> Hi
>
> I am trying to execute the following code: -
>
> strSQL = strSQL & Nz([" & strCOM_Year & "], 0)
>
> where strCOM_Year is a string I want the system to use as a field
> name. It doesn't like this. Keeps saying 'can't find the field "|"
> referred to in you expression', even though I can clearly see in the
> debug window that the current value of strCOM_Year is "2006/2007".
> i.e. I am looking for the value in the field called 2006/2007.
>
> Any ideas?
>
> Stapes

You're missing some quotes...

strSQL = strSQL & "Nz([" & strCOM_Year & "], 0)"

-- 
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com


0
Rick
6/10/2007 12:43:38 PM
On 10 Jun, 13:35, Stapes <steve.sta...@gmail.com> wrote:
> Hi
>
> I am trying to execute the following code: -
>
> strSQL = strSQL & Nz([" & strCOM_Year & "], 0)
>
> where strCOM_Year is a string I want the system to use as a field
> name. It doesn't like this. Keeps saying 'can't find the field "|"
> referred to in you expression', even though I can clearly see in the
> debug window that the current value of strCOM_Year is "2006/2007".
> i.e. I am looking for the value in the field called 2006/2007.
>
> Any ideas?
>
> Stapes

Hey

The index shows a reply to this by Rick Brandt - but I can't see it!!!

What's happening?

Stapes

0
Stapes
6/11/2007 10:56:31 AM
"Stapes" <steve.staple@gmail.com> wrote in message 
news:1181559391.959258.196510@p47g2000hsd.googlegroups.com...
> On 10 Jun, 13:35, Stapes <steve.sta...@gmail.com> wrote:
>> Hi
>>
>> I am trying to execute the following code: -
>>
>> strSQL = strSQL & Nz([" & strCOM_Year & "], 0)
>>
>> where strCOM_Year is a string I want the system to use as a field
>> name. It doesn't like this. Keeps saying 'can't find the field "|"
>> referred to in you expression', even though I can clearly see in the
>> debug window that the current value of strCOM_Year is "2006/2007".
>> i.e. I am looking for the value in the field called 2006/2007.
>>
>> Any ideas?
>>
>> Stapes
>
> Hey
>
> The index shows a reply to this by Rick Brandt - but I can't see it!!!

Rick's reply was:

You're missing some quotes...

strSQL = strSQL & "Nz([" & strCOM_Year & "], 0)"

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



0
Douglas
6/11/2007 12:36:36 PM
Reply:

Similar Artilces:

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? > > ...

Date field to filter combo list box
I have a date field named [JobRequestDate] following that I have a combolist box [SchedDateTime]. The scheddatetime lists times from Mon to Sat. At the moment, when you pick a jobrequestdate (say a Thursday, date shown in short form) you have to scroll down the combo box to the 'Thur' times. (However, the problem is that sometimes a wrong day is being picked and the Job goes to the wrong place (it's doesn't match the jobrequestdate field). I would like to be able to filter the [SchedDateTime] field to show ONLY the times for the day chosen in the [JobRequestDate] field. The J...

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...

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...

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...

Field names?
Can anyone tell me what type field and the field names are for the Vote Tracking Recipient and Response? I do see one called "Voting Response" under "All Mail Fields", however that is only showing me my vote responses to someone else, i.e. not thost that I've sent out for a vote myself. Please help, Steve The Voting Response field works for me in my Inbox when I recieve votes in response to an email I send out with Voting Buttons on it. Judy Gleeson MVP Outlook Trainer and Consultant read my articles here: www.judygleeson.com Canberra, Australia how to post qu...

Subform in Datasheet View
Is there a way to have the datasheet view of a subform *not* show the "button-like" row that shows the field names? -- Thanks, tbl No there isn't. If you create a continuous style form, you can eliminate the headings. You can modify a continuous form so that it looks like a 'datasheet'. -- Joan Wild Microsoft Access MVP "tbl" <hateThatSpam@invalid.net> wrote in message news:4gqs13dds31nhu1bsmbrm5tt86adbfea1m@4ax.com... > Is there a way to have the datasheet view of a subform *not* > show the "button-like" row that shows the field n...

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...

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...

Report field size
I have added 2 fields to my invoice form (single invoice). How do I force these fields to display the same text size as the rest of the report? I'm using Report Writer. Thanks in advance. if you are working on a graphical report, you can click on the field and press CTRL + D or go to Tools >> Drawing Options. select the appropriate font size and click ok. You may have to check the default font size of other fields so you'd know what size to use. Hope this helps. Rheiner "Billie Dee" wrote: > I have added 2 fields to my invoice form (single...

For tickets, a bigger Notes field, please.
When working with tickets, under Details > Information > Notes and Article, the Notes field only uses half of the window (vertically). The bottom 2" of the window, under the Show Article check box, is unused. I have to scroll the unnecessarily-cramped Notes field almost every time I view a ticket. Please consider expanding the Notes field to the biggest size the window will permit. ---------------- 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 ...

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. > > ...

Pivot Tables
I have a sales application that contains tables of approx 70 fields with sales data for each year, one of which is a year field. I'd love to combine the tables into a single table so that I can represent the data in a Pivot Table, but need to figure out how to show, create, calculate a variance field, and a % variance field in a pivot table if I do combine the tables. In the Pivot table I'd want to show: 2004 Sales 2005 Sales Variance % Variance 10 12 2 20% Note: The Sales field is the same field, just a different year Any Suggestion...

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...

typed variables
I just now noticed there is a big difference in coding $i = [int] 9.99 and [int] $i = 9.99 PS C:> $i = [int] 9.99 PS C:> $i 10 PS C:> $i = 9.99 PS C:> $i 9.99 PS C:> [int] $i = 9.99 PS C:> $i 10 PS C:> $i = 9.99 PS C:> $i 10 How would I take away the type binding from $i without deleting the variable once I associate a type with it? - Larry you can change the type [double]$i = 9.99 Typing as an integer and then giving it a non-integer value could cause issues with your logic -- Ric...

how to set default date value in the Date time field
I have added an attribute of type Date Time in the form of my entity. I want to display current date as default date value. Please tell me how can i set the default date value to the current date. i got it by writing a simple javascript code. Thank u "Rama" wrote: > I have added an attribute of type Date Time in the form of my entity. > I want to display current date as default date value. > Please tell me how can i set the default date value to the current date. > ...

How to evaluate VB constant name in string variable?
Greetings! Example: the value of vbOkay within the VBE is 6. {i = vbOkay} yields i = 6. Would like a construct where {sMyString = "vbOkay" : i = UnknownFunction(sMyString)} yields i = 6 TIA! George Try i = VAL(sMyString) -- Regards, Nigel nigelnospam@9sw.co.uk "G Lykos" <GLykos@CompuServe.com> wrote in message news:%23iVJr8tqKHA.3408@TK2MSFTNGP06.phx.gbl... > Greetings! > > Example: the value of vbOkay within the VBE is 6. {i = vbOkay} yields i > = 6. > > Would like a construct where {sMyString = &q...

? Using environment variables in filenames
Hi, I have a bit of code where I use a CFile to check to see if the file designated by the filename in m_File exists. The problem is that if I put a variable in the filename ie, %systemroot%\system32\calc.exe in m_File, and open it with CFile, then it returns a file not found error. How can I get around this? -- Alec alec@synetech.cjb.net > I have a bit of code where I use a CFile to check to see if the file >designated by the filename in m_File exists. The problem is that if I put a >variable in the filename ie, %systemroot%\system32\calc.exe in m_File, and ...

Delete all Named Ranges except PrintArea
I have the following function that just needs a slight tweak. I need t delete all Named ranges EXCEPT for PrintArea. What do I need to do t adjust this Macro so that it does not delete the Named Range fo PrintArea. Thanks Sub DeletePhantomRangeNames() For Each nm In ActiveWorkbook.Names nm.Delete Next nm End Su -- Doctor ----------------------------------------------------------------------- DoctorV's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=514 View this thread: http://www.excelforum.com/showthread.php?threadid=26772 Doc, Dim nm As Name For Each n...

Docmd.SendObject To: Cc: Bcc: Fields
Where I work at we still use Access 97. Nothing I can do about that. Anyways it appears the To: Cc: and Bcc: Line of the Docmd.SendObject have a max string length. Only 2/3 of my concatenated string transferred into the To: Line. I assume there is nothing I can do about it, but figured I'd ask. On Mar 3, 3:31=A0pm, Apexstar <Apexs...@discussions.microsoft.com> wrote: > Where I work at we still use Access 97. Nothing I can do about that. > Anyways it appears the To: Cc: and Bcc: Line of the Docmd.SendObject have= a > max string length. Only 2/3 of my concatenated...

Variables/Bookmarks in powerpoint
Hi, is it possible to create bookmarks in powerpoint like in Word. I want to reference the title and date from the title slide in other slides without retyping it. Thanks. Dwayne On 3/1/10 1:55 PM, Dwayne Roberts wrote: > Hi, > > is it possible to create bookmarks in powerpoint like in Word. I want to > reference the title and date from the title slide in other slides > without retyping it. > > Thanks. > Dwayne I'm not sure what you mean by a bookmark in this case. A bookmark in Word takes you to a specific place in a document. The only ...

SSIS Variables and variables. What is best practise.
Dear reader, At the moment I am strugling with the deployment and configuration of a set of SSIS packages. I have one package [A] which calls the packages A1, A2 and A3. Each package starts with reading the parameters from a database. I found a script on the web which does read all the matching parameters from the database into the package. (http://blog.boxedbits.com/archives/8). Thanks for that script. But each script (A1,A2,A3) still needs the location of the database where to read the parameters, I use to variables for that, one for the servername, one for the databa...

How to put names over columns and left-justify numbers or align decimal points
I already have made the spreadsheet and want to put names over the columns without making a new row for the names. Is this possible? Like I don't wantt A1 B1 etc. to change to A2 B2 etc. when I put the text above the columns. Then I want to save it as an .htm file so that the tables will have headings like what I have put over the columns. The columns will have to get a little wider to accommodate the headings over them. I need to left-justify the numbers in the columns or line up the decimal points vertically. This is not currency, if that matters. Ike wrote... >I already hav...