Microsoft Access 2018 - adding new data entries using a form - ms-access

I am creating a form, in which I want it to create a new row of data in my table. However, whenever I input something into this form instead of creating a new data entry, it picks an existing one and modifies it.
Any insight would be appreciated!

If the form is bound to a table; then one must advance to a new blank row. There are several form types: In a Continuous or Datasheet form - one simply scrolls to the bottom to find the new blank row. In a Single Record View form - one must use the record selector in the bottom frame of the form to advance to a new record or add a button that advances to a new record/row. There is also an option in form properties to be a Data Entry Form that will only open to a new record.

Related

ms access: 'cannot assign value to this object' message, but assigning value works anyway

I have a strange issue with one of my data entry forms. I have a main form from which I open said data entry form using a button. Once the form is open, I can enter a new record (the DE-form is set to allow additions and data entry is set to YES). The first time AFTER opening the main form, and only the very first time (subsequent tries work as intended), when opening the DE-form from the button and attempting to enter new data into the field "Bezeichnung", I get the following error message:
You can't assign a value to this object.
The weird thing comes now. After clicking OK in the dialogue box, in spite of what the message just indicated, the field contains the character I had just entered and allows me to continue adding data without issue.
After adding the new record and confirming, it shows up on my main form, as well as the related table, as intended. I have tried making a new DE-form from scratch but encountered the same thing. The message only pops up the very first time I attempt to enter new data via the DE-form after opening the main form. Opening the DE-form a second or third time while the main form is still up does not result in the same message. Also, it's the same with any of the fields on the DE-form, not just the first one. After the message pops once, it never shows up again until I close the main form. This is the only DE-form in my project that has this issue, I can#t seem to figure out why. Any help is appreciated.
Database Structure:
Details of my data entry form:
*The DE-form consists of a form with a subform on it (white box in the middle). I have other forms where this is neccesary and in order to keep the design consitent I opted to do the same with this one. Both forms have an invisible textbox bound to stoff_id. The DE-subform has Link Master Field and Link Child Field set to stoff_id
Recordsource DE-form main
SELECT chemikalien_tabelle.stoff_id
FROM chemikalien_tabelle;
Recordsource DE-form sub
SELECT chemikalien_tabelle.stoff_id, chemikalien_tabelle.bezeichnung, chemikalien_tabelle.einsatzgebiet, chemikalien_tabelle.kategorie_id
FROM kategorie_tabelle INNER JOIN chemikalien_tabelle ON kategorie_tabelle.kategorie_id = chemikalien_tabelle.kategorie_id;
I found a solution on another site. Apparently, what is causing the message is an invisible textfield bound to the primary key stoff_id (which is AutoValue) of chemikalien_tabelle on the DE-subform. I usually add the primary key somewhere to my forms since it is likely I will need it. I still don't know why this issue popped up though. The original answer I am refering to did not either Foreign Solution. The post is in German, so check it out at your discretion. Removing the textbox fixes the issue but without it I cannot assign a completely new record. I have a number of other data-entry forms that have the same setup, so I am not sure why this only caused issues in this particular case. Maybe someone else has a an idea?

Access 2010 - Bound Textbox - Only updating newest record created

I am trying to update the textbox for the current request that I have opened. After making changes to the bound textbox (regardless of the record number current being edited) it modifies the tblVendorRequests.VendorDiscussionNotes for the newest request created within the table.
My form is a Single Form
My record source for my form is a table (tblVendorRequests)
My textbox (txtVenConLog) is using tblVendorRequests.VendorDiscussionNotes as its control source
For instance, say I am trying to add notes "Hello World" to request number 242. Request 242's notes remain the same, but the "Hello World is added to the newest record instead (overwriting the existing text that was in the request).
I have done a good amount of searching on the topic, and have not found a satisfactory answer on why this would be.
Any ideas would highly appreciated!
I redesigned my form to split the functions into 2 separate forms and that seems to have resolved the issue. I believe the issue was that when I 'opened' a record, it was not behaving like it would if the record-opening function resulted in calling a form to open with specific criteria.

Method 'Parent' of object failed

I have MS Access 2013 and I'm trying to make a search form that populates other details when a row inside a subform is selected. I figured out how to get which row is selected, and which column, but now I need to pass that information to the parent form so I can populate the other things on the form.
So on my form's subform, I made an On Click event:
Option Compare Database
Private Sub Form_Click()
MsgBox(Me.Name) ' returns P_pat subform
MsgBox(Me.Parent.Name) ' says 'Parent' failed
But it can never find its parent. I also tried on a few other events but the results were the same. The Access form looks like this:
The highlighted subform is the one I'm trying to work with, and I want it to call the parent so that the parent can populate its other child subform (the one below the highlighted form).
I feel like I slammed into a brick wall that shouldn't be there and my pride hurts.
How do I get the parent?
I know that I can simply set the record ID I selected with a global variable, but I have no way of triggering an update event for the other subform.
Any help or advice?
There doesn't look like there is anything at all wrong with your code. So from research there seem to be three possible solutions that I have found so far:
Make sure there are no special characters in your forms' names
Compact and repair
Create a new blank project and import all of your database into the blank project

Cannot find the referenced form

When I click on the Create New Form button below, I get the following runtime error 2450 dialog box:
When I click on the debug button, it gives me the following:
The main form is called FindClientsNavigation. The "Create New Form" button in the ListOfForms subform is supposed to cause the NavigationSubForm to replace the ListOfForms form with a new CommunicationForm so that the user can enter information from a new form for the Client with the specific Client ID that is available in the txtClientID textbox, which you can see in the top of the FindClientsNavigation form in my first image above.
How do I alter the code above so that it loads a new CommunicationForm in the NavigationSubForm? And how do I get that new CommunicationForm to have the ClientID stored in it, so that submitting the form will allow the form to be saved with reference to the specific ClientID?
The SourceObject needs to be set to a string, which is the name of the form to use:
.SourceObject = "CommunicationForm"
[Note that Forms is the collection of open forms so you cannot use this to refer to a form in the Navigation Pane - unless you know that this form is open.]
You can use the Client ID (on the main form) for this subform, but there are a number of ways to do this and it depends on your specific requirement:
The subform could be based on a query that refers to the textbox (perhaps txtClientID) on the main form. This is one of the simpler approaches.
You could dynamically set the RecordSource for the subform, using a WHERE clause that refers to the Client ID (similar to the above approach).
You could apply a Filter to the subform, so that it only displays the single record for the Client ID.

In VBA/Access get value from current record when changing records

I have an Access database. I have a map control embedded in a form (using MapInfo, but that's not important). When a user goes from one record to another I would like the map to re-centre on the appropriate coordinates. To do this I need to get the coordinates which are stored in the current row of the table which is the data source for the form. My question is how I access this value. This is pretty simple, right?
I have worked out that the "On Current" event is triggered when the record is changed but I can't seem to refer to the xcoord and ycoord fields in the current row.
This page seems to suggest that I need to create a module to do this. Surely there's a simpler way?
Thanks in advance!
Update: If I put a pair of textbox controls in the form that display the x and y coordinates then I can access them by doing Me.x_coord. Is this the answer?
In Access VBA you can reference the fields of a bound form's recordsource with the syntax:
Forms!your_form_name!your_field_name
In your case, you can grab the current x_coord with Me!x_coord. No need to bind it to a control to get the data.