MS Access context menu filter message The object doesn't contain the Automation object 'me' - ms-access

I have a form that I open in either datasheet or continuous forms view with four fields bound to text columns in a linked table. If I right click for the context menu and filter on column 1 or 2 equal to one of the values it filters OK; If I try to filter on field 3 or 4 I get the message "The object doesn't contain the Automation object 'me'". If I select 'Text Filter' on fields 3 or 4 and enter some text, it filters OK.
I would be grateful if anybody that has experienced this can tell me why it happens and how to either trap or stop it.
Thanks

The problem is with Conditional Formatting on the columns. If I remove conditional formatting, filtering via the context menu works fine, replace the formatting and filtering shows the message (but still filters correctly!!)

This is an old post, but you are correct. I also discovered the cause of this error was incorrect Conditional Formatting. I kept getting an error on a form about "Object doesn't contain the Automation object [text box]". I couldn't find that [text box] anywhere. Then I realized I had Conditional Formatting on some of the fields. Sure enough, one of the Conditional Formatting rules was referencing this text box that apparently I had removed.

Related

Is there a way to use buttons in MS Access to fill in text boxes in a report?

Here's the crux of the question, I have 26 compliance queries to run, in a previous question it was suggested that I should filter a single query, or two, on a single report. I like this idea, and have rewritten the query to pull all available data from all the fields, this query works fine. The report will work fine as well, as it does with a model query that I had coded up beforehand. What I would like to do is this:
The end user is being given an interface in access that is locked down, I want them to click a button, and that button will run the query and send to the text box just the field that is called for.
I have tried doing this through VB using the where clause and aliasing the column being called, this did not work at all. I have the report currently pulling the correct data, but not displaying the dates along side it. But it is filtering correctly aside from that.
So what needs to happen is this : Button click : Query runs, and is filtered for "Compliance Issue 1" and puts the dates in "Compliance Issue 1" in the text box on the report.
Right now... I get a list of names, the correct list of names, but an empty column.
I have tried using OpenArgs, but all it did was fill in the date column with "Compliance Issue 1" not the actual data in that column.
Is what I am trying to do even possible in access, and if so does someone have a reference or suggested starting point.
My background : 6 Months of python coding, 3 months of SQL , and some limited access from 20 years ago.
As noted, using the filter of the openreport is without question the way to go (one would not write a whole bunch of different queries - you can send/have any filter for that report - you can EVEN use a sub query in the filter that you send to the report.
As for displaying values in the report that are not from "rows" of data?
There are two approaches that work quite well.
First up, is you have that launcher form. This of course allows the user to select critrea - maybe even some nice combob boxes. These selections take care and you build up the filter in code that you pass to the report.
As for text boxes to be filled out from that form and inclluded in the report?
If they are static values from the report (say filter options, or even just a notes box that you could type in some text? To display such values in textboxes on the report?
You can directly set the text box data source (in the designer) to the report propter form like this:
=(forms!MyPromptForm!notes)
So, any value you shove into text boxes on the report prompt form can thus be displayed in any text box on the report with the above type of expression. And it does not even take code to achieve this goal. So, you could say with above enter some notes into that text box, and thus on the report, whatever you typed into that text box will now show up in the report. You just drop in a text box onto the report, and set the data source of the text box to the above expression that references the form with the values we want from that form.
The next approach, and I often use this in the case that some value/expression/calculation has to occur for each row. In this case, you can use the reports on-detail format event. This allows you to run code for EACH row of data.
You are free to run ANY code in that event - and that includes after running such code to set a text box in the reports detail section.
So, say the query only had the Hotel ID (PK). This is a lame example, but you could then write this code in the on-format event of the reports detail section.
dim strSQL as string
dim rst as DAO.RecordSet
strSQL = "SELECT HotelName from tblHotels where ID = " & me.HotelID
set rst = CurrentDb.OpenRecordSet(strSQL)
me.HotelName = rst!HotelName
rst.Close
So in above, we assume that a row text box is called HotelID, and then in code we build a whole sql query from scratch, pulled the row data from a table, and then SHOVE/SET the value of the un-bound text box called hotelName.
As noted, the above is a simple example, but we are free to run any code we want, pull any data we want, and set the value of ANY text box for the given detail section ONE row of values.
So, above shows two approaches. The first approach is code free - and you can put forms! expression directly into the report, and the values from that report prompt form will thus show up directly in the report. However, if you need VBA code to run for each row, pull values, walk the dog, and THEN set a text box on that one details row of data, then you are as above shows free to write procedural code in the report that fires + runs for each row of data - and that means you can quite much do anything you want in terms of running code. I mean, even that on detail format event COULD pull values from your report prompt form, but as the 1st example shows, you can shove in forms! expression directly into a text box - and those forms! expressions can be values from a existing form that is open before the report is launched.

How to Receive, Modify and Save value from same textbox in MS Access 2010?

Please support.
I've an Access Form with few combo and text boxes. I'm calling information in some text boxes from access tables after selecting value from one of the Combo box. Values are coming correctly but I also need to replace the old information with new one and update the same table again with new information. I tried many VBA codes but Access is giving me error "Reserved Field" every time and close the form automatically.
Can someone please help me here? Let me know what more information you need from my end. I'll be grateful to you. Thank you
With out seeing specifically what you are trying to do it is difficult to be sure what you need. What I think you want is to update the test boxes and the desired table fields based on a combo box selection.
If that is your desire you need to bound the text boxes as suggested. Then the VBA code would update the value property of the text box:
if me.controls("comboboxname").value = "a" then
me.controls("textboxname").value = "A"
Else
if... (etc etc)
Or instead of nested ifs you could use case.
Once the form was closed or the record changed the tables would be updated.

How can I display zero-value records in a text box control?

This is probably a beginner question and I am missing something fundamental, but I appreciate anyone's time and effort.
I have inherited an Access database, where the data is kept in a separate file to the forms and reports.
A report is used to create a letter to summarise a set of results.
The relevant part is in the Detail section of the report, where pairs of Text Box controls are used to show the name of the test, and the result.
The behaviour of the text boxes is that they are hidden (including the name of the test) when the value is zero in the database. However, sometimes we need to include a zero value.
Is this default behaviour?
I have inspected the VBA project and cannot find any logic that is hiding the text boxes.
Other information:
The field is set up as Number (double)
The default value for the field has been made empty, not 0 which seems to be the default.
I have tried using the format property for the control using #;#;0;"" as described here (http://www.experts-exchange.com/questions/21525364/Show-zero-values-as-dashes-on-an-Access-report.html)
I have also tried using ControlSource =IIF([fieldvalue]>0,[fieldvalue],"0") which did show a zero, but the descriptor text box still disappeared, and it was appearing as 0 whether the database field value was 0 or nothing.
Please let me know of any other details that would be helpful.
Thank you everyone for your help.
I hadn't traced back for enough in the logic chain, which #KenWhite's answer gave me the hint for.
The issue was in the query underlying the report - the logic for the field had conditional parameters on it, using IIf() and NULL / 0 checks.

Passing Parameter to next form starting with parameter input dialog

I'm trying to create a database that is user friendly. So far I've developed two forms.
Form 1 shows an overview of orders. Form 2 shows the details of a specific order. Form 2 is build on a query that retrieves information from different tables.
When I open form 2, a parameter input dialog box appears asking me which ordernr he has to look for. When I type in a number, the specific details from that record are shown.
Now comes the tricky part. form 1 shows the overview. When i click on an ordernr a textbox is filled. I did this to confirm the program reads the right number.
My question: How do I get the number from my textfield in form 1, into the parameter input dialog in form 2? The numbers are stored as text so no conversion is needed.
I saw a lot of solutions with DoCmd.OpenForm "Formname" ,,,,,, OpenArgs. I do believe this can be the sollution. I just don't know how to get OpenArgs into the Parameter Input Dialog.
Thanks for helping!
Change the query of the second form to have the value of the text box that you populate as a filter on the ordernr field. You might also to set the 'Modal' property of the second form to 'True' as this will prevent (or hinder at least) unsynced forms.

SUM() on a form footer resulting in #Error

I'm trying to display the sum of a field in a text box in the form footer. The field is not calculated in any way.
Here are a couple of the things I've tried:
=Sum([txtWeldInches])
=Sum([WeldInches])
=Sum(CDbl([txtWeldInches]))
=Sum(CDbl([WeldInches]))
...well you get the idea. Each iteration I've used results in the Text Box displaying #Error Without exception.
I've used similar constructs in different forms in the same project, so I'm not sure what the problem might be.
Has anyone run into this before?
EDIT:
I ended up writing a VBA routine to update the boxes when it was likely that they would be changed rather than trying to get a bound sum() function to work.
http://support.microsoft.com/kb/199355
All of the domain functions are based on the same query (over the underlying recordset). If one of the bound functions on the form has a binding error, all of the functions on the form will return an error.
In other words, make sure all your footer controls are resolving properly and not hitting any nulls.
If you use a SUM or AVG then make sure you are also using the Nz function:
ControlSource = =SUM(NZ([FIELD],0))
Is the field "WeldInches" existing in the data source for this form?
What datatype the field "WeldInches" is?
EDIT: I have looked at all your comments. If it doesn't work by databinding, try and use the unbounded way. At runtime, get the value of WeldInches using DSUM and set the footer textbox's value when the form loads.
Also, remember to update it at places where you think the SUM could change.
I had the same problem as Rister.
The source of the form was an underlying query.
I had a bound text box named txtQty on this form. Its control source was Qty (based on the underlying query of the form).
I created an unbound text box and entered =SUM([txtQty]) and received an error.
I tried various ways to find a solution and was very desperate.
Then I deleted the underlying query and created a new one using the same name and fields as before.
Then I entered =SUM([Qty]) into the unbound text box on the form and voila, it worked. Note that I didn't enter the name of the bound text box (txtQty) into the expression, but its control source (Qty). I don't know why, but it worked for me.
I know you said "Form" but for those who have issues with the Sum formula in an Access "Report" the formula has to be in the Report Footer NOT the Page footer. Took me a while to figure it out as Access defaults to only showing the page footer.
You want to sum by the name of the column in the record source: SUM([WeldInches])
Make sure there are no other textboxes with the name WeldInches.