Microsoft ACCESS database record field not whats shown - ms-access

Working with a MS ACCESS 2010 accdb file. Within a table, on one particular record, I am experiencing something odd with a text field.
The text field is shown to be populated with Gzzzzzz. However, clicking on the fields [down arrow], [Text Filters], [Equals...] and pasting Gzzzzzz returns nothing. Then, clicking on the fields [down arrow], the shown field populations include GzzzzzzGzzzzzz: not, Gzzzzzz. Selecting GzzzzzzGzzzzzz a record is returned with the field populated with Gzzzzzz.
Showing all the fields again, and editing the field to Azzzzzz. Then, filtering on Azzzzzz again returns nothing. Then, filtering field options show AzzzzzzGzzzzzz: which when selected, returns Azzzzzz.
Also curious, when I filtered as above then look at the Property sheet, at this point the Filter shown is ([TableName].[FieldName] = "Azzzzzz ...missing the final "). However, when I filter on a working record, the Filter is shown as ([TableName].[FieldName] = "Whatever"): meaning shown completely with the trailing ").
The field is not indexed. There are no defaults or formatting. The table is related to three other tables: but, not on this field and not with Enforce Referential Integrity. Other records in the table are fine and work. Just this record's field.
Does anyone know how this happens? Is there a method to repair the record?

The field in the record probably contains
Gzzzzzz
Gzzzzzz
(with a newline in there) which isn't easily visible in a single-line textbox.
Use Shift+F2 to open the Zoom window. Or "tab" into the control, so everything is selected. Then delete the whole content and re-enter.

Related

Find out which database entry has changed

I have a field in my typo3 backend. If i add something to the field and click "save" then an entry in the database is created.
What i try is to find out which table is modified in my database, after i add a new item to the field and click save.
I found out that there is a tracking option in phpmyadmin, but im not sure if this function is what i am searching for.
My ui is in german, "Nachverfolgung" means "tracking".
How can i find this out?
Open one of the records containing the field in question in the TYPO3 backend, and inspect the field using the developer tools of your browser.
In TYPO3 7.6 and upwards check the attribute data-formengine-input-name of the input field, in TYPO3 6.2 and downwards check the name attribute of the input field (or sometimes a hidden field besides it). Its value will look somehow like this:
data[tx_news_domain_model_news][6][author_email]
The value in the first pair of brackets is the table name, the value in the second pair is the records uid, and the value between the last pair is the field name. So in the example, the table name would be tx_news_domain_model_news and the field name is author_email.

Access report showing #Name? in text box bound to query result

I have a table (named Responses) with a field named q01 which contains numbers from 1 to 5. All entries contain valid numbers.
I created a query named query11 which counts the number of entries in Responses with a number 1 in q01. (Two columns in the query. First has Field: q01, Table: Responses, Total:Expression, Criteria: 1, Show is unchecked. Second has Field: Count_1_1:q01, Table:Responses, Total:Count, show is checked.) This shows the correct count when the query is run.
I created a report named rpt_General which contains a text box (named txtQuery1-1) with the control source =[query11]![Count_1_1]
Any time this is run it displays #Name? in the text box. I have done some research and seen a number of references to the name of the text box being duplicated elsewhere, but I have changed it numerous times, deleted and recreated the report, and still cannot get it to display correctly.
Thanks to both HansUp and LiamH, I was able to get this working by substituting this as the text box's Control Source.
=DCount("*","[Responses]","q01=1")
Also, I had not added query11 into the report's record source.

Access displaying first record when using combo box to switch records

I have an Access database that uses linked tables residing on a SQL Server. For one of these tables I created a simple form showing several fields of the underlying table.
I want to switch records using a combo box, so I added one using the Combo Box Wizard, where I selected the option "Find a record on my form based on the value I selected in my combo box".
The combo box works, but I noticed that whenever a new value is selected, Access will briefly return to the first record before displaying the selected record. I can verify this by both noticing a screen flicker (e.g., bound fields briefly display data from the first record), as well as profiling the calls to SQL Server, where I can see one query for the first record, and another query for the selected record.
This problem does not occur if I use the next/previous Navigation Buttons at the bottom of the form.
How can I avoid this unnecessary query?
What using the Wizard did was create a Macro behind the Event of your combobox click. It probably looks something like .. , , First, ="[SomeField] = " & Str(Nz(Screen.ActiveControl,0)) .. What you can actually do, instead of using the Macro, is follow something like this
If we look at what that Macro does (or what arguments it accepts), it is a little more clear on why you may be experiencing that behavior.
The first argument is Object Type then Object Name, then Record, then Offset.
Object Type - The type of object that contains the record you want
to make current. Click Table, Query, Form, Server View, Stored
Procedure, or Function in the Object Type box in the Action
Arguments section of the Macro Builder pane. Leave this argument
blank to select the active object. <- Yours would be left blank because you're referring to the combobox on the form
Object Name - The name of the object that contains the record you
want to make the current record. The Object Name box shows all
objects in the current database of the type selected by the Object
Type argument. If you leave the Object Type argument blank, leave
this argument blank also. <- Because the first was left blank
Record - The record to make the current
record. Click Previous, Next, First, Last, Go To, or New in the
Record box. The default is Next. <- This defaulted to First for me and possibly for you too, probably why you were seeing this 'odd' behavior
Offset - An integer or expression that evaluates to an integer. An
expression must be preceded by an equal sign (=). This argument
specifies the record to make the current record. You can use the
Offset argument in two ways: When the Record argument is Next or
Previous, Microsoft Office Access 2007 moves the number of records
forward or backward specified in the Offset argument. When the
Record argument is Go To, Access moves to the record with the number
equal to the Offset argument. The record number is shown in the
record number box at the bottom of the window. Note If you use
the First, Last, or New setting for the Record argument, Access
ignores the Offset argument. If you enter an Offset argument that is
too large, Access displays an error message. You can't enter
negative numbers for the Offset argument.
I wish I could give you more details, but I have not used Access in conjunction with SQL Server, so if that plays into account I would not have any insight.

"Run time error 3167: Record is deleted" when unchecking a selection in multi select listbox

I have a form that contains a multi-select list box, a user can check off as many selections as required, then hit the "save" button, which saves the form fields, and the checked off selections in their respective tables.
Everything works perfectly fine, until a user unchecks a selection that had previously been saved.
I have tried several things, including refreshing the form, and the recordset, to no avail.
While testing to find a solution, I commented out every single line of VBA code tied to the form's save button. When clicking this button, obviously nothing happens with the code commented out, but if I try and close the form with the window's "x" button, I then get a message box stating "Record has been deleted"
I have no idea where to look at this point, I've tried to compact and repair database, also with negative results.
I have no code to post, as it doesn't matter what code I try to run, I get the error, a completely empty sub still gives me the error.
Again, this only happens when a user unchecks a selection that previously had been checked off.
Here is a screen shot of the form:
The list box in red is the culprit.
A user can edit every single field on the form and it all works fine, a user can even "add" selections from the listbox by checking items off, and it will save them, and show them the next time the record is viewed.
The problem occurs when a user unchecks one of the selections that were previously checked off.
Details of the listbox:
It is a multi select list box populated by a "lookup" that was created with the listbox wizard
The values selected are saved in a field as a comma separated list
The field itself is a lookup of another table, that allows multiple values
At this point I'm not even sure I'm explaining myself properly, I've gone so far down the "rabbit hole"!
If any clarifying statements are needed please ask away.
The following describes my implementation of what I think you were trying to do, but there may be some variations. The key point is I was able to reproduce your 'Deleted record' error on a regular basis, but somehow finally got it to stop.
I created a table named 'res_area' with an ID field and an 'area'. I populated with rows for '1E, 1F, 1I, 1J, 3C, 3D, 3E, 3F, 3I, 3J, 3K, etc.'
I created table 'res_tow' with all the fields you show on your form. I included a field named 'area' that is a LOOKUP field with the following source: "SELECT [res_Area].[TTID], [res_Area].[Area] FROM [res_Area] ORDER BY [Area];". Allow Multiple Values = yes.
I created form 'frmEditTow' with the Record Source:
SELECT res_Tow.TowID, res_Tow.TCompany, res_Tow.TPhone1, res_Tow.TPhone2,
res_Tow.TPhone3, res_Tow.TType, res_Tow.TTown, res_Tow.TAddress,
res_Tow.TFileName, res_Tow.TComments, res_Tow.TChecks, res_Tow.area
FROM res_Tow;
I added the 'Save Record' button with code to: 'DoCmd.RunCommand acCmdSaveRecord' and 'Me.Requery'
I am able to add or delete any combination of list items and save the changes.
For what its worth, I think my earlier version of the rowsource for the form included field 'area' and 'area.value'. With that, the form recordcount reflected the total number of listbox items selected - not the number of rows in table 'res_Tow'.
Good luck!

Access report field truncating at 255 characters

I have a report whose record source is a query, say qryRecords. In the report header I want to add a lengthy notes field (longer than 255 characters). I have set up a table to hold these notes (with a field type "memo"), and because that table is separate from the record source for the report, I was going to put the Notes field in the report using VBA code.
In the open event of the report, I have added this code:
Dim rst as Recordset
Dim sql_qry as String
sql_qry = "SELECT notes FROM tblNotes WHERE id = 1;"
Set rst = CurrentDb.OpenRecordset(sql_qry)
rst.MoveFirst
Me.txtNote = rst![notes] 'I get the run-time error on this line
Unfortunately I get a run-time error where noted ("You can't assign a value to this object"). I found a person with a similar issue on a form, and the suggestion was to move the code from the open event to the OnCurrent event, but that event doesn't exist for a report. Any suggestions? Thanks.
--- Original Question ---
I have a form with an unbound text box (txtNotes), and when the user opens the form, the text box is populated with text that is longer than 255 characters (it concatenates various fields from the database). This works with no problem.
There's a button on the form that opens a report, and in the report, I set the Control Source for a text box to Forms![frmMain]![frmSub]![txtNotes], which is the text box mentioned above. That works too, but for some reason the text on the report is truncated at 255 characters. The form's text box is unbound, so there's no underlying table to limit the length. Does anybody know why this would happen or if there's a workaround?
Most likely when the data from the field is being cast as a Text type rather than as a Memo. Really there's no way to explicitly cast a Text as a Memo (you can go the other way around though with CStr). I had problems with truncation on the form as well when experimenting with this scenario.
I'd suggest you are probably generating this field on the form in the wrong way. Dollars to doughnuts you could generate it in a query (used in the form's Control Source), rather than concatenating it together and placing into an unbound field. Likewise, you could then use that same query as the control source for the report that you are opening.
If all of that is truly impossible, I'd point you at dumping the values from the form into a table specifically for the report and then using the table as a control source for the report.
---- Edit ----
I still contend that you can add it to your Report's data source. In my example below, I've tacked on tblNotes to a select on the Bar table.
SELECT bar.f0, bar.f1, bar.f2, bar.f3, tblNotes.notes
FROM bar, tblNotes
WHERE tblNotes.id = 1;
Yes, if there is 300 rows of Bar, you'll get 300 copies of the same Notes field, but that's a minor problem.
Form there, you just make txtNote's data source the tblNotes.Notes column. txtNote can certainly exist in the report/page header, and when MS Access generates it, it will only use one row. I'm not sure if picks the first/last row, or random row - never the less since they are all the same, it doesn't matter.