Modules & VBA :: Editing Existing Record Using Subform
Jan 8, 2015
I'm successful in adding data from the form to the table using VBA. But I couldn't retrieve and edit the data. For retrieving and editing the data I have a different form "[Forms]![Editor]". I have all the fields listed in the image in both the form and table.
1. I want to allow the user to search and retrieve a specific row based on the condition Incident ID and the Package code are same
2. I want the user to edit the fields in the form and update it in the same row again.
What event would I attach code to, to have a message box pop up warning the user when that he is editing existing records.
I would like the message to appear not as the form loads, or as he tabs to the first control, but right as he makes any changes to the data displayed. Preferably the box should have a "OK" to continue the edit and a "Cancel" to undo it.
I am having difficulty getting the right record to carry forward into a modal subform to edit/update information. The Request_nmbr is an autonumber field. The client can have multiple requests. When I open my subform, I can scroll through the records, but when I launch the "update" button, I don't know how to carry forward the request_nmbr so that I'm updating the right record.
Here's my code: Private Sub Btn_Exception_SubModal_Click() DoCmd.OpenForm "Frm_Exception_UpdateModal", acNormal, , acFormAdd Forms! [Frm_Exception_UpdateModal]![Request_nmbr].value = Me![Request_nmbr].value Forms! [Frm_Exception_UpdateModal]![clientnmbr].value = Me![clientnmbr].value End Sub
I have a form and subform. The subform is connected to the form and display all BandID's associated with that record. What i want is the ability to click on a record in the subform so that it automatically set's that record in the form for editing.
In my form I have a subform, which displays A, B, C. Then information C is displayed in textbox. User should have a possibility to modify this data in order to modify data in database.
I am able to display information C in text box based on this subform. However it is uneditable, although property of enabled is yes and locked is no.
It seems to me, that it is impossible to edit data because it is taken not directly from database but from sub form, so I make special query which takes data directly from database however I lose an event which is based on selecting proper record from subform (there is only onEnter and onExit events)
I have written the following code. I want to change the status of my order when reminaing products shipped is equal to zero. When I run this code I get error " Cannot update. Database or object is read only". I think that this error is because that I am using the front end of the database.
Code:
Private Sub Form_AfterUpdate() Dim dbs As DAO.Database Dim rstTest As DAO.Recordse Dim strQuery As Strin strQuery = "SELECT OrderingT.Order_ID, OrderingT.UnitsRequested,OrderingT.OrderStatus, ([UnitsRequested])-Count([Product_ID]) AS [The Remaining
I have a form and I want show a message on the form when the it is locked as another user is editing the data in a particular record.
I know the record selectors show the records lock status but it a very tiny symbol which will mean nothing to the users of the database and anyway I don't want record selector bar on the form. How I would do this???
I have a linked table to a DB2 database. this table contains key-pair values and has about 140k records.
I use a Sub to update the value of a specific record.
The sub starts by opening the needed DAO recordset Then it uses the rs.Findfirst method It checks if rs.Nomatch is not true (so the records exists!) Then it starts updating the record with rs.edit rs!value1 = myvalue1, rs!value2 = myvalue 2 rs.Update There is where I get the '3021 No current record' error
I use the same sub on the same table to update to different parts. One part works the other gives me the error.
When we browse through records in a subform we store the records in the database.When we want to delete a records for example the third record from the five records always the first records will be deleted. How can we delete the records where the cursor is at? When we are at the third record and press the delete button the third record from the list in the subform should be deleted.
Code:
Option Compare Database Dim FocusBln As Boolean Private Sub Identificeer() Me.[Datum Aangemaakt].Visible = True Me.[Datum Aangemaakt].SetFocus If Me.[Datum Aangemaakt].Text = "" Then
I create a form using a wizard, then I go into my subforms and edit it to look more easy on the eye. I save the form and close it, when I re-open the form it looks fine except that the subform appears as a blank white space with Name Subform in top left corner of the sub form??
I've got a master form, which is used to search for records, and display links to them in a list box. When the user selects a record, they get the full details of the record on a subform. At the top of the subform, I have two buttons, an edit button, which allows them to make changes to the record, and a "new" button, which allows them to create a new record.
My problem is, after a new record is created, the subform adds a new page. So instead of having record one of 1, it shows record 2 of 2. So if a new record is saved, and the user tries to access another record, nothing appears because the subform stays on record 2 of 2(which is a blank undirtied record). If you press navigation button back it will show the record they selected.
Maybe I could make the new form a pop up form, and pass it parameters rather than making a new form within the subform.
I've tried putting the command DoCmd.GoToRecord , , acPrevious in the subforms Current() method, but I get an error saying I cannot go to the previous record.
I have 5 subform named "bene_subform1", "bene_subform2", "bene_subform3", "bene_subform4", "bene_subform5", and i would like to know if it's possible to msgbox the record from the beginning to end of record in sub-form 1, loop thru all the 5 subform via VBA?
I have designed a datasheet in a subform and it has a nested datasheet inside of it. I have it all designed and now I want to disable the user from doing anything to either, such set column widths, set colours etc. How would I do that?
I've been asked to get some information from my database and I'm a bit stuck.
I have a list of refunds in tbl_main and each one includes a dateReceived. I make a record in either tlk_located, tlk_unableToLocate or tlk_bulk depending on the outcome when we're trying to send the money back to whoever it belongs to. Each table has a time stamp (named locatedTime, unableTime and timestamp respectively) field
My manager wants me to report how many entries were unworked on each day in the year, and what the value of them was. An entry is unworked if there is no entry in either of the 3 tables.
So I need a query that lists a range of dates, and for each date counts the number of entries where tbl_main.dateReceived is <= to that date and either has no record in located,unable or bulk or has a record with a timestamp > than the date. (It has been processed now, but hadn't been on the date we are looking at)
I can manage a query that looks at a certain date that it prompts for on each run:
Code: SELECT Count(tbl_main.trust2PK) AS CountOftrust2PK, Sum(tbl_main.amountRefunded) AS SumOfamountRefunded FROM ((tbl_main LEFT JOIN tlk_located ON tbl_main.trust2PK = tlk_located.trust2FK) LEFT JOIN tlk_unableToLocate ON tbl_main.trust2PK = tlk_unableToLocate.trust2FK) LEFT JOIN tlk_bulk ON tbl_main.trust2PK = tlk_bulk.trust2FK WHERE (((tbl_main.dateReceived)<=[cutoffDate]) AND ((tlk_located.locatedTime) Is Null Or (tlk_located.locatedTime)>[cutOffDate]) AND ((tlk_unableToLocate.unableTime) Is Null Or (tlk_unableToLocate.unableTime)>[cutOffDate]) AND ((tlk_bulk.timeStamp) Is Null Or (tlk_bulk.timeStamp)>[cutOffDate]));
I would like a query that lists all dates in a range, and shows the same information for each day listed.
Hi I was wondering if anyone could shed any light on this problem. I have a new database going live in two weeks. My problem is that I keep getting a message telling me that someone else is editing the record.. which is an impossibility as it is a stand-alone copy on my hard-drive at home! How is this possible? Will this problem be solved once I have this database on the sql server and the tables has been upsized to sql? Also this database is to be used by up to 100 people is this going to be a problem?
I created form based on a query of around 7 tables, all the fields are set to enabled and edits are allowed; however, access wont allow me to edit any of the fields in that form! I know that the query is correct because i can flick through the records and the fileds change.. please help:eek:
I am trying to update prices changes for products in my inventory database, and am stumped.
I select a vendor, which then populates the product name from which I can then select the product I want to update. From here, it populates what the current prices are. I then can type the new price into the next box, but what happens is that it doesn't change that Product it changes the 1st record.
I have the employee data record... I want copy of the same record to insert in table but with different employee id and Site through forms. StaffNo is the primary key.
My main form has a union query as it's record source. This displays a list of items for which the user uses this form to apply a category for each of the items. This relationship of item to category is stored in a temporary table. I have a subform with a list box that shows the current selections and is based on the temporary table. The linking of the master and child is based on the "description" field. I would like the user to be able to select one of the items in the list and have the main form go to that record. (the list box has multiselect set to none).
I have a main form "Furniture_CatCodeAssets" which shows detail specifics about certain furniture item codes (width, height, colour etc.). I have a subform "Furniture_AssetsSubform" which shows all of the asset numbers associated with that furniture item code.I have a combo box that allows you to filter by furniture category, that then updates a list box that shows only the item codes associated with that category. When an item code is selected in the list box the main form and the subform update to show what was selected. (I mention this only in case it is causing an interruption - they work perfectly.)
What I am trying to do now is add a text box and button that will allow you to search in the subform to find a specific asset number and go to that item code on the main form.
I have the following code on the command button: Set rst = Forms!furniture_CatCodeAsset.Furniture_AssetsSubfo rm.Form.RecordsetClone rst.FindFirst "[Asset Number]=" & Me.textSearch If Not rst.NoMatch Then Forms!furniture_CatCodeAsset!Furniture_AssetsSubfo rm.Form.Bookmark = rst.Bookmark Else MsgBox "No match found, please check your asset number and try again." End If Me.textSearch = Null rst.Close Set rst = Nothing
Which returns the message box that nothing was found even though I know I that asset number exists.
I use the first record of my table as a blank when the form is opened. Users are supposed to use a drop down to navigate to a record for updating. Some users have populated fields into my blank that i've had to go in and delete.
I'm wondering if there is a way to prevent that first record from being edited.
I have had a form working for ages. It has a main form and eight subforms at the bottom of the form. The main form can be edited in all fields.
I have taken a copy, modified the form added new fields to the main source table and updated the query that feeds the form.
Now (in the copy environment) it won't allow me to edit any of the fields. All of the form control properties are the same as the working model (in the live environment) I can run the query by itself and all is OK
There is obviously some little control that I have inadvertently changed and can't see it.
I have a form that uses a combo box to select the record to edit which then opens the edit form... I keep getting a type mismatch error. The bound column is a text column and I'm wondering if that is the problem because this works perfectly everywhere else in the database. The primary key is the SKU of the product which is alphanumeric which is why I have it set to text...
I'm having a bit of a problem with a database I'm trying to create, what I am trying to do is create a database to handle jobs in an IT workshop. The idea is that you generate the job card and then at the bottom you have a section to enter in the parts that are required for the job, and then have a report that prints out a list of all the parts required for all the jobs under a heading of the job card number.
The problem I am having is how to add this sub form / table to the job card sheet. I tried putting in a sub table, but that wont let me make additions to it, and I tried putting on a form but that wont retain more than one entry per job card (I have put it on continuous form).