473,396 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

error; [2465] Mircosoft Access cant find the field '|" referred to in your expression

133 100+
the following code is generating an error; [2465] Mircosoft Access cant find the field '|" referred to in your expression"

any suggestions would be appreciated.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Expire_Date_Qry_Parameter_AfterUpdate()
  2.   On Error GoTo Err_Hndlr
  3.  
  4.     Forms!F_Contract_Mgt_Entry!Expire_Date_Temp_Parameter = Forms!F_Contract_Mgt_Entry!Expire_Date_Qry_Parameter
  5.     DoCmd.OutputTo acOutputQuery, stDocName, [Excel 97 - Excel 2003 Workbook (*.xls)], AutoStart
  6.  
  7.    MsgBox "Task Complete!"
  8.  
  9.  
  10. Exit_Expire_Date_Qry_Parameter_AfterUpdate:
  11.     Exit Sub
  12.  
  13. Err_Hndlr:
  14.     MsgBox "[" & Err.Number & "]:  " & Err.Description, vbInformation, "Expire_Date_Qry_Parameter_AfterUpdate()"
  15. End Sub
  16.  
May 14 '10 #1

✓ answered by dowlingm815

Got it...the solution the error code is the syntax for the output...the code should be:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OutputTo acQuery, stDocName, "MicrosoftExcelBiff8(*.xls)", "", True, "", 0
** Edit **
The explanation is that quotes are needed around the format parameter. Changing the value of the parameter (as shown here) was not relevant.

11 4496
Jim Doherty
897 Expert 512MB
@dowlingm815
There is nothing in your code to suggest what stDocName is.
Is the query that presumably is stDocName getting its value from the form control Expire_Date_Temp_Parameter? If so what does the query syntax say?
May 14 '10 #2
dowlingm815
133 100+
stDocName is a global variable. Depending the client's response, stDocName receives a Query Export, as in this case, or Report Preview. The Query receives date parameters from the form.

unfortunately, i don't have access to the code until monday.
May 15 '10 #3
NeoPa
32,556 Expert Mod 16PB
Posting the full error message is helpful. Identifying the line the error occurred on would be even more helpful. I guess it's probably line #5, but confirmation would be good.
May 15 '10 #4
NeoPa
32,556 Expert Mod 16PB
If this is indeed the case then I expect the problem is within your query rather than the VBA code.

What happens when you try running the query normally (to show on screen) at the point this crashes (I'm talking about suspending the code to do the test)?
May 15 '10 #5
dowlingm815
133 100+
the non-vba query has a field name "ExpirationDate" that will receive the value from the form's field. the criteria is "<[Forms]![F_Contract_Mgt_Entry]![Expire_Date_Qry_Parameter]"

everything looks fine to me. funny thing is the query is called twice with two separate conditions. the first condition generates a report, the other condition, this condition, generates a query to be exported.
May 17 '10 #6
NeoPa
32,556 Expert Mod 16PB
Could you explain that second paragraph. I couldn't work out what you were trying to say.

If it helps, drop the relevant code in.
May 18 '10 #7
dowlingm815
133 100+
The application has a screen that offers three choices. When the second or third choice is selected, the event procedure kicks off a query that receives a date field from the screen. there are two different date fields to coordinate with the user's selection.

the code has a temp field that receives the date value and passes it to a query. when the second choice is selected, the query runs without errors. when the third choice is selected, the following error code is generated:

[2465] Mircosoft Access cant find the field '|" referred to in your expression"

when the query has the parameter removed, no error is generated. again, what is brothersome, it basically runs the same code for the second selection, and generates an error on the third run.

the entire code is as follows:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Option Compare Database
  3.  
  4.  
  5. Private Sub Contract_Mgt_Rpt_by_Contract_Status_Click()
  6.  
  7. On Error GoTo Err_Hndlr
  8.  
  9.  
  10.     Forms!F_Contract_Mgt_Entry!Expire_Date_Temp_Parameter = Null
  11.     Forms!F_Contract_Mgt_Entry!Expire_Date_Qry_Parameter = Null
  12.     Forms!F_Contract_Mgt_Entry!Expire_Date_Rpt_Parameter = Null
  13.     Forms!F_Contract_Mgt_Entry!Expire_Date_Rpt_Parameter.Visible = True
  14.     Forms!F_Contract_Mgt_Entry!Expire_Date_Qry_Parameter.Visible = False
  15.     stDocName = "R_Contract_Status"
  16.  
  17.  
  18. Exit_Contract_Mgt_Rpt_by_Contract_Status_Click:
  19.     Exit Sub
  20.  
  21. Err_Hndlr:
  22.     MsgBox "[" & Err.Number & "]:  " & Err.Description, vbInformation, "Contract_Mgt_Rpt_by_Contract_Status_Click()"
  23.  
  24. End Sub
  25.  
  26. Private Sub Expire_Date_Rpt_Parameter_AfterUpdate()
  27.  
  28. On Error GoTo Err_Hndlr
  29.  
  30.  
  31.     Forms!F_Contract_Mgt_Entry!Expire_Date_Temp_Parameter = Forms!F_Contract_Mgt_Entry!Expire_Date_Rpt_Parameter
  32.     DoCmd.OpenReport stDocName, acPreview
  33.  
  34.  
  35. Exit_Expire_Date_Rpt_Parameter_AfterUpdate:
  36.     Exit Sub
  37.  
  38. Err_Hndlr:
  39.     MsgBox "[" & Err.Number & "]:  " & Err.Description, vbInformation, "Expire_Date_Rpt_Parameter_AfterUpdate()"
  40. End Sub
  41.  
  42. Private Sub Expire_Date_Rpt_Parameter_Enter()
  43.  On Error GoTo Err_Hndlr
  44.  
  45.  Forms!F_Contract_Mgt_Entry!Expire_Date_Rpt_Parameter = Null
  46.  
  47. Exit_Expire_Date_Rpt_Parameter_Enter:
  48.     Exit Sub
  49.  
  50. Err_Hndlr:
  51.     MsgBox "[" & Err.Number & "]:  " & Err.Description, vbInformation, "Expire_Date_Rpt_Parameter_Enter()"
  52.  
  53. End Sub
  54.  
  55. Private Sub Expire_Date_Qry_Parameter_AfterUpdate()
  56.   On Error GoTo Err_Hndlr
  57.  
  58.     Forms!F_Contract_Mgt_Entry!Expire_Date_Temp_Parameter = Forms!F_Contract_Mgt_Entry!Expire_Date_Qry_Parameter
  59.     DoCmd.OutputTo acOutputQuery, stDocName, [Excel 97 - Excel 2003 Workbook (*.xls)], AutoStart
  60.  
  61.    MsgBox "Task Complete!"
  62.  
  63.  
  64. Exit_Expire_Date_Qry_Parameter_AfterUpdate:
  65.     Exit Sub
  66.  
  67. Err_Hndlr:
  68.     MsgBox "[" & Err.Number & "]:  " & Err.Description, vbInformation, "Expire_Date_Qry_Parameter_AfterUpdate()"
  69. End Sub
  70.  
  71. Private Sub Expire_Date_Qry_Parameter_Enter()
  72.  On Error GoTo Err_Hndlr
  73.  
  74.  Forms!F_Contract_Mgt_Entry!Expire_Date_Rpt_Parameter = Null
  75.  
  76. Exit_Expire_Date_Qry_Parameter_Enter:
  77.     Exit Sub
  78.  
  79. Err_Hndlr:
  80.     MsgBox "[" & Err.Number & "]:  " & Err.Description, vbInformation, "Expire_Date_Qry_Parameter_Enter()"
  81. End Sub
  82.  
  83. Private Sub ExportContractData_Click()
  84.  
  85.  On Error GoTo Err_Hndlr
  86.  
  87.  Forms!F_Contract_Mgt_Entry!Expire_Date_Temp_Parameter = Null
  88.  Forms!F_Contract_Mgt_Entry!Expire_Date_Qry_Parameter = Null
  89.     Forms!F_Contract_Mgt_Entry!Expire_Date_Rpt_Parameter.Visible = False
  90.     Forms!F_Contract_Mgt_Entry!Expire_Date_Qry_Parameter.Visible = True
  91.     stDocName = "Q_2_Recs_<_ExpireDateParameter"
  92.  
  93. Exit_ExportContractData_Click:
  94.     Exit Sub
  95.  
  96. Err_Hndlr:
  97.     MsgBox "[" & Err.Number & "]:  " & Err.Description, vbInformation, "ExportContractData_Click()"
  98. End Sub
  99.  
  100.  
  101.  
May 18 '10 #8
dowlingm815
133 100+
for some odd reason, i believe it is the following statement in the code:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  DoCmd.OutputTo acOutputQuery, stDocName, [Excel 97 - Excel 2003 Workbook (*.xls)], AutoStart
  3.  
  4.  
May 18 '10 #9
dowlingm815
133 100+
Got it...the solution the error code is the syntax for the output...the code should be:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OutputTo acQuery, stDocName, "MicrosoftExcelBiff8(*.xls)", "", True, "", 0
** Edit **
The explanation is that quotes are needed around the format parameter. Changing the value of the parameter (as shown here) was not relevant.
May 18 '10 #10
dowlingm815
133 100+
case closed...
May 18 '10 #11
gershwyn
122 100+
@dowlingm815
You want quotes around the format parameter:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OutputTo acOutputQuery, stDocName, "Excel 97 - Excel 2003 Workbook (*.xls)", AutoStart
I don't know if that will fix everything or not, but I think Access is getting confused by the brackets.

EDIT: I was too slow, you solved it yourself. :)
May 18 '10 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jibu | last post by:
Hi I am using SmtpMail class for mail sending. I could able to send mail using my mailse server to our LAN. But when I tried external addresses it showed the exception Message "Could not...
0
by: Jon | last post by:
If anyone can help...Whenevr I go into a form and use the ctrl+F to find something with the binoculars the "Search field as formatted" is checked as default. This seems to slow down the find...
4
by: Bruce Skamser | last post by:
I added a field to a table and when I go to the form to add a textbox control, I can't bind it to the field in the table. It doesn't come up in the list of fields in the control source dropdown. ...
7
by: musclemilk | last post by:
Good day, now i know that someone was having the same error message and i read the thread but didnt help me out too much! so basically i have a command button that on a form that needs to open...
3
by: ontherun | last post by:
hi, i have two forms CHS_Customer and 'CHS_Job' both have a common field, "Company_Name" i want to open the form 'CHS_Job' from the form 'CHS_Customer ' and when i open, the Company_Name field...
4
kcdoell
by: kcdoell | last post by:
Hello: I have the following afterupdate event: Private Sub GWP_AfterUpdate() 'Updates the Total calculation in the control "SumGWP" on the quick reference 'table that is located on the form...
2
by: zufie | last post by:
I have an Option GROUP which produces 6 different report between two dates. A separate Option BUTTON determines the period of the report once I enter the From & To Dates into the textboxes. I...
2
by: shalskedar | last post by:
I 've created Report in Ms access which contains subform.The field value in the report is retrieved from the subform.When this report is exported,it shows the error as The expression you entered has...
8
by: Slamowitz | last post by:
I have as client database (Access 2000) that runs fine, but every time I either do a Repair/Compress, Import it into a new blank database or make any vba code changes to it I get a Run-time error...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.