This is my first database I am building, and am no Access expert, but I do think that I understand the basics.
I have deleted an old field from the back end of a split database, and edited the record sources of the forms that use the table as the record source. I deleted several fields, but one (a number field) is giving me trouble. Whether I open the underlying table or the forms that use the table as a recordsource, an "Enter Paramater Value" Dialogue box appears asking for the value on the form. I have looked at an older version of the database, and the field is not a primary key. I am quite stumped on this one. I have confirmed that the field is deleted from the recordsources and the table, so I'm not sure why it is still behaving like this.
Thanks.
Check Order by and Filter properties of the forms and queries which show such error.
Related
I want to preface this by saying I don't have any real programming background, I'm just trying to update an existing database at work.
We have an access database and I want to add an additional Y/N checkbox to an existing form. The form updates a SQL table. Currently the record source is a SQL statement.
I can go to the SQL table, add a new field and make it Yes/No data type. There are other Yes/No fields in the table and the default settings for the new field are identical to the others. I next go and update the linked table through External Data in the ribbon. I can go into the table in Access and see the new field - so far, so good.
Next, go to the form design view and form properties, go to the record source, update the SQL statement to include the new field. (I've also tried this thru query builder, same result.) From here, I start to get the error.
If I go back to form view and change any data in the form and hit the next record button or save button, I get the Write Conflict error. "This record has been changed by another user since you started editing it..." The 'Save Record' button is greyed out. I am the only person accessing the database or SQL server.
I've tried to finish building the new button and linking it to the new field in control source (that went fine), but it didn't make any difference. If I go in to edit the record source and remove the new field, everything works again (but of course, the new field isn't in the control source list, so isn't linked to the check box).
Any ideas? Thanks.
A strong contender for the reason for your problem is the form itself.
Most likely the form is setup with a specific query as the Record Source. Its not to say that that is inherently incorrect, but it makes adding new columns to the source significantly more difficult.
The problem would likely be solved if you just changed the Record Source to reference the table itself, rather than a query, if that is in fact how it is referenced.
If Ms Access tries to pull data from a table using a query through a form it will inherently Pessimistically Lock the table in question, making it unable to be modified. However, you can usually still modify the table through the query itself, but you would need to add the column changes into that query first.
I'm not quite sure if I am making sense here, but something like this (for a table called "Table1"):
In theory, if the form is the problem... then if you closed it and tried to make modifications to the table, then the changes should work when the form is closed.
Someone else fixed it for me, but from what I understand, it was a communication issue between SQL and Access. Something with the setting of the null value in SQL not being set the way that Access could understand.
We had the issue narrowed down. When the new field was added to the table, you couldn't change any info directly in the table, but you could with the form.
If you added the new field to the form's record source, you couldn't edit any info at all.
Thanks for everyone's input.
I have encounter an odd problem with a specific field which has the Field Name: Billing and is Datatype: Short Text. When I try to sort alphabetically the result on the Report is actually based on a corresponding field that is datatype Autonumber and also serves as the tables primary key.
All other fields in the report sort just fine.
I would like to think I have tried the usual corrections, but may have missed one and I am hoping someone can point this out if that is the case.
Generally I would go into design view of the report, select the field on the Report, click the 'Group & Sort' button on the ribbon and make my selection for how I want to sort from there.
How I know that it is the Autonumber field that is being sorted is that when I switch from A-Z to Z-A, the top result when Z-A is in fact the final entry in the table and concurrently the highest number in the Autonumber and primary key field.
I cannot see how these two fields are linked or why the Billing field is sorting based on the Autonumber field. I have removed the primary key and still encountered the same problem.
A final note that may help point me in the right direction. When I go to the table that holds the field in question I've noticed on Datasheet View there is no option to sort this field. All other fields have the option to sort by clicking the black triangle, but this field does not have this option. I believe the sorting does take place on the Report, but I found it odd that all the other fields could be sorted in Datasheet View, but not this field. Any help is greatly appreciated. Thanks
UPDATE
So a (hopefully) short update to this situation. The solution I undertook was as follows.
Exported the table with the sorting problem to excel. From there undertook the process of duplicating the table with no data in it and then ran an append query to put the data back into the table.
This worked! … kind of.
I had suspected since I began trying to fix this issue that the sort was being affected by the primary key number. I feel this has been confirmed, but it has created a new issue.
What has occurred now is that a relationship query no longer functions because the fields are no longer the same type. One field is an autonumber primary key while the other field is short text. I can only conclude that the field prior to the excel export/import was data type number, even though the data within the field was all text and no numbers. But, it was necessary to have this field as a number so that the relationship to the autonumber field in the other table would function.
Overall it is a small victory in that the report that I first noticed the error on, the error being it would not sort in proper alphabetical order, is now sorting properly. This is an important report that is used often so I needed to get it working properly to move things forward. Unfortunately I have now entirely lost the use of a different report because of a ‘Type mismatch in expression’ which I am concluding is the autonumber to short text relationship.
So I am going to post a new question about relationships and datatypes to see if there is someone that can assist in getting this fully functioning again. I hope this helps others who have encountered this problem.
I've been having an issue today where one of my forms is filling all fields with "#DELETED" after I save the record. This wasn't happening three hours ago, and it seems to have started without me changing anything on the form itself. The record is still being saved, and there are no "#DELETED" entries in the table at any point. I am using the following code to open the form:
DoCmd.OpenForm "frmPoster", , , , acFormAdd
This is the code that saves it:
Call DoCmd.RunCommand(acCmdSaveRecord)
I am using Access2010 with SQL Server and VB. As I said, the really confusing part is that seemingly nothing has changed about this form that would be causing this. It worked, and now it doesn't. Any ideas?
Also, if you want any more information regarding the issue, I will be happy to provide.
I've used SQL with Access a lot and had some similar problems, I'd advise unless you have already to make sure you have a timestamp field in the SQL data, and also do a me.requery in VBA after the update so it re-selects the record.
I ran into the same problem yesterday - as soon as I try to save the record, all fields turn to #Deleted. Tried to resolve for hours - no luck.
I use Access 10 / 2016 and MySQL ODBC connector 5.3.
I narrowed it down to one specific field with a 13 digit number.
The datatype for the field was varchar. When I enter any value that does not match the required format (as checked by VBA), and then delete or edit it and move to the next field, the form refuses to create the UserID upon save and gives #Deleted.
If I skip this field during data entry, then the form creates the UserID (Primary Key) and saves. Also, if I enter a value that matches the field criteria first time round, the form generates the Primary key and saves.
As suggested somewhere I changed the datatype to numeric 14,0 for this field.
This did not help.
I tried to requery the form after saving as suggested but since the record is deleted, it simply displays blank fields.
So here is my hack:
1. On the "On Enter" event of the first field in the form, run code to set temporary values in each of the required fields, for example:
First I created an unbound hidden field with default value of "No". Then:
If Me.NewRecord=True and Me.FormPreppedYN="No" then
Me.txtFirstName="Hello"
Me.txtLastName="There"
Me.IDNr=123
Me.Ref="ABC"
Me.Dirty=False
Me.txtFirstName=""
Me.txtLastName=""
Me.IDNr=Null
Me.Ref=""
Me.txtFirstName.SetFocus
Me.FormPreppedYN="Yes"
End If
This forces the form to create a Primary key. This happens very quick and the user doesn't notice it. They just enter the data.
This worked reliably every time. I still don't know what causes the error, but this fixes it.
We are rebuilding an asset database with Access 2013. We have 1 table with a Primary Key (Serial number of asset), and 22 other fields. We're designing a form to be used with the table so that we are not manually editing the table. The 'Status:' field explained later does not exist in the table; it is a user friendly way to show if the record exists or not.
The end goal is to have a form that will two cases. A user will enter a PK and hit the tab key. Then:
If the PK exists, it will pull the info from the other 22 fields and put them into the fields on the form (1:1) and update 'Status:' to 'Existing'.
If the PK does not exist, it will change the 'Status:' to 'New' and make all of the fields blank.
Most of the fields on the form will be Combo boxes. There will be a couple text fields and 1 date/time field.
Once a user is done with the form and has made any necessary changes, there will be a 'Save' button at the bottom that will write whatever is in the forms to the row indicated by the PK.
I have found partial solutions with the LostFocus() event in Access 2013 on the PK field of the form. I have little experience with MS Access, moderate experience with DBA, and no experience with VBA programming. I'm sure this solution can be done, my question is: can it be solved in a way other than hard coding the solutions? I also looked around for form building, but I couldn't find anything that worked how we need it so if there is a tool that can accomplish this, that is acceptable.
You might consider a form that contains a subform. Basically, you would design a form that has your PK input box and a subform. When the user hits tab (or a "Search" button), a query would run to search the table and display that record in the subform, or you could insert a new record if not. You may need to use a few queries and macros to link it all together, but it can be done code-free.
I have an Access database that is used to store basic info in a table such as first and last name. How would I go about adding the functionality to lookup by last name?
Is there a way to type in the last name and then hit like F12 or something like this? Can someone please point me in the right direction or provide me a link?
SELECT tblPatient.LName AS [Last], tblPatient.FName AS [First]
FROM tblPatient
WHERE (((tblPatient.LName)=[Enter Last Name]));
How do I tie this into my form now?
I'd suggest you create a form, with a textbox 'search' at the top, then either a listbox or subform below to display results.
The listbox record source would be:
SELECT tblPatient.LName, tblPatient.FName
FROM tblPatient
WHERE tblPatient.LName LIKE Forms!myForm!search & '*';
You can either add a Search button, which requeries the listbox, or do the requery via the Change event of the search textbox. The later may be slow if you have a large number of records; if that's the case, you could check that at least 3 (?) characters have been entered before calling the requery.
You just need to create a query in which you put =[?] as the "last name" value.
When you open that view, you'll be asked to type in a lookup value for that field.
Not sure if this is what you are trying to archieve, though...
This is probably a bit overkill for what you want to do, but I assume that you want to perform a search by last name. You should be able to glean the information you need from this article:
Build a search criteria form
http://www.everythingaccess.com/tutorials.asp?ID=Build-a-search-criteria-form
You can create queries in Access if the user you're targeting with the searchability has Access themselves.
From the main Access UI (assuming Access 2007), go to the Create tab and then select the "Query Wizard." Here is an article on the subject.
Otherwise you can create a program and connect to the MDB/ACCDB file running the query programmatically.
Seeing you wish to look up a name and populate the form based on the name selected, I suggest you need a combobox. There is even a wizard for doing exactly what you want. To start, you will need a form bound to a table or query, that is a form with a Record Source.
Add a combobox to your form
Select :
Find a record on my form based on the value I select in my combobox
Select the ID (primary key), Last and First name fields.
Access will display an example, suggesting that you hide the Key (id) column. Accept this.
Choose a name and finish.
There are a few other small things that could be done for neatness, but you will end up with a form that find the record you want. In addition, the combo will autocomplete if you type in a few letter.
If this is an mde, which your subsequent post seems to suggest it is, there is little you can do wuth out the original file. However, you could try opening the database while keeping the shift key held down and see if that allows you to edit. If you cannot get the original and the shift does not work, you could try rescuing the data, if it, too, is stored in this file.