the following code is generating an error; [2465] Mircosoft Access cant find the field '|" referred to in your expression"
any suggestions would be appreciated. -
Private Sub Expire_Date_Qry_Parameter_AfterUpdate()
-
On Error GoTo Err_Hndlr
-
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Temp_Parameter = Forms!F_Contract_Mgt_Entry!Expire_Date_Qry_Parameter
-
DoCmd.OutputTo acOutputQuery, stDocName, [Excel 97 - Excel 2003 Workbook (*.xls)], AutoStart
-
-
MsgBox "Task Complete!"
-
-
-
Exit_Expire_Date_Qry_Parameter_AfterUpdate:
-
Exit Sub
-
-
Err_Hndlr:
-
MsgBox "[" & Err.Number & "]: " & Err.Description, vbInformation, "Expire_Date_Qry_Parameter_AfterUpdate()"
-
End Sub
-
Got it...the solution the error code is the syntax for the output...the code should be: - 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 @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?
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.
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.
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)?
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.
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.
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: -
-
Option Compare Database
-
-
-
Private Sub Contract_Mgt_Rpt_by_Contract_Status_Click()
-
-
On Error GoTo Err_Hndlr
-
-
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Temp_Parameter = Null
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Qry_Parameter = Null
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Rpt_Parameter = Null
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Rpt_Parameter.Visible = True
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Qry_Parameter.Visible = False
-
stDocName = "R_Contract_Status"
-
-
-
Exit_Contract_Mgt_Rpt_by_Contract_Status_Click:
-
Exit Sub
-
-
Err_Hndlr:
-
MsgBox "[" & Err.Number & "]: " & Err.Description, vbInformation, "Contract_Mgt_Rpt_by_Contract_Status_Click()"
-
-
End Sub
-
-
Private Sub Expire_Date_Rpt_Parameter_AfterUpdate()
-
-
On Error GoTo Err_Hndlr
-
-
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Temp_Parameter = Forms!F_Contract_Mgt_Entry!Expire_Date_Rpt_Parameter
-
DoCmd.OpenReport stDocName, acPreview
-
-
-
Exit_Expire_Date_Rpt_Parameter_AfterUpdate:
-
Exit Sub
-
-
Err_Hndlr:
-
MsgBox "[" & Err.Number & "]: " & Err.Description, vbInformation, "Expire_Date_Rpt_Parameter_AfterUpdate()"
-
End Sub
-
-
Private Sub Expire_Date_Rpt_Parameter_Enter()
-
On Error GoTo Err_Hndlr
-
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Rpt_Parameter = Null
-
-
Exit_Expire_Date_Rpt_Parameter_Enter:
-
Exit Sub
-
-
Err_Hndlr:
-
MsgBox "[" & Err.Number & "]: " & Err.Description, vbInformation, "Expire_Date_Rpt_Parameter_Enter()"
-
-
End Sub
-
-
Private Sub Expire_Date_Qry_Parameter_AfterUpdate()
-
On Error GoTo Err_Hndlr
-
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Temp_Parameter = Forms!F_Contract_Mgt_Entry!Expire_Date_Qry_Parameter
-
DoCmd.OutputTo acOutputQuery, stDocName, [Excel 97 - Excel 2003 Workbook (*.xls)], AutoStart
-
-
MsgBox "Task Complete!"
-
-
-
Exit_Expire_Date_Qry_Parameter_AfterUpdate:
-
Exit Sub
-
-
Err_Hndlr:
-
MsgBox "[" & Err.Number & "]: " & Err.Description, vbInformation, "Expire_Date_Qry_Parameter_AfterUpdate()"
-
End Sub
-
-
Private Sub Expire_Date_Qry_Parameter_Enter()
-
On Error GoTo Err_Hndlr
-
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Rpt_Parameter = Null
-
-
Exit_Expire_Date_Qry_Parameter_Enter:
-
Exit Sub
-
-
Err_Hndlr:
-
MsgBox "[" & Err.Number & "]: " & Err.Description, vbInformation, "Expire_Date_Qry_Parameter_Enter()"
-
End Sub
-
-
Private Sub ExportContractData_Click()
-
-
On Error GoTo Err_Hndlr
-
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Temp_Parameter = Null
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Qry_Parameter = Null
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Rpt_Parameter.Visible = False
-
Forms!F_Contract_Mgt_Entry!Expire_Date_Qry_Parameter.Visible = True
-
stDocName = "Q_2_Recs_<_ExpireDateParameter"
-
-
Exit_ExportContractData_Click:
-
Exit Sub
-
-
Err_Hndlr:
-
MsgBox "[" & Err.Number & "]: " & Err.Description, vbInformation, "ExportContractData_Click()"
-
End Sub
-
-
-
for some odd reason, i believe it is the following statement in the code: -
-
DoCmd.OutputTo acOutputQuery, stDocName, [Excel 97 - Excel 2003 Workbook (*.xls)], AutoStart
-
-
Got it...the solution the error code is the syntax for the output...the code should be: - 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.
@dowlingm815
You want quotes around the format parameter: - 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. :)
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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. ...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
| |