Modules & VBA :: Creating New Record Within Subform - Cannot Navigate To Other Active Records
May 4, 2015
I have a main form that controls 2 subforms. sbfActiveProjects displays a list of records that have not been flagged as complete. Upon clicking on a record in sbfActiveProjects, the details of that record show up in sbfProject. This functionality works great, except when I try to create a new record. The code works fine for getting a new record, however once I run the command I lose my ability to navigate to other active records.
Code:
Private Sub cmdNewProject_Click()
'set focus to sbfProject
sbfProject.SetFocus
'navigate to new record
DoCmd.GoToRecord , "", acNewRec
End Sub
I have a form that lists records in a table. I would like to have a hyperlink beside each record that will open the data entry form and navigate to that specific record. Right now, the use can only open the form for all records and has to use the record navigation buttons to find the desired record.
How do I display a more meaningful message instead of the cryptic error about having to enter data into blah blah blah. How can I trap that error and provide them a more meaningful message about entering data. I have tried the following;
Main form name frmPatientRecords Sub form name DentalRecords Subform Private Sub Form_BeforeUpdate(Cancel As Integer) If Nz(tblPatientDetails!recordid, 0) = 0 Then MsgBox ("sorry. Please complete the main record entry") Parent.SetFocus End If End Sub
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
Basically what I am doing is duplicating a split form. I am not using a split form because I want to be able to have better control over the bottom half, and I am giving the end user a slightly different view of the same information in the bottom pane.
I've created a form with a subform. When the user moves through the records in the subform, I want the parent form to navigate with it. Note the parent child relationship does not apply here.
I've almost got it working fine, but there is a bug. It seems to originate when the user clicks on the subform ID field while the cursor is the cross, like the Excel fill symbol. Now if the focus is on the subform where ID=2, when the user moves to the parent, the parent navigates away from the record for some reason.
I've noticed that the GotFocus event is firing multiple times, and some of the events are nested. I've tried to set a flag to prevent the nested events from firing, but the bug persists.
I'm new to access and am currently building a simple db customers table and jobs table, I have a setup a relationship between the 2 and have the jobs bt las a sub form of the customer, but only showing a small amount of the job data.
What I would like to do is be able to click on a specific job within the job subform and navigate to that record in the job form where I can see all the data about that job.
Hi, im having a problem with shring my db over a networkt,
as far as i understand access 97 locks a page (2k) of records when a record is being edited, does anyone know a way in 97 how i can get access to lock ONLY the EDITED record and not the page?
in Tools/Options/Advanced i have "edited record" locking clicked and each form locks only the record edited but its still locking the page, i know there is "record level locking" feature in Access 2002 but not in 97, is this possible?
I have put some VBA code into my database to link and text boxes to different tables. The code works, but once I enter a Tracking Number that finds a NABP number I am unable to go to a dofferent record or save. I also want to edit the fields so I am unable to use a query since you cannnot edit queries. Here is the sample of my code.
Code: Private Sub Form_AfterUpdate() On Error Resume Next Dim db As Database Dim rs As Recordset
I have a button to navigate to the next record. I also have a button to add a new record. I want the next record button to be able to navigate to the next record but I don't want it to be able to create a new record if I click the button while being on the last record. I want it to stop at the last record, making my add a new record button the only way to create a new record. How to do that?
basically i want to have a button that opens up a form that links to the record i'm currently viewing. But then i want to be able to navigate to the other records, in access when you use the wizard to find specific data on a form it doens't then let you navigate to the other records
I was wondering if what I'm trying to do in Access XP and 2003 is possible. I've looked at countless templates and samples and havn't seen anything like what I want to do to be able to construct it. I've tried manipulating queries, relationships different table joins but to no avail. I'm only a beginner in VBA and know little SQL, I would be truly gratefull if someone can please shed some light on the below.
I've been creating a preventitive fleet maintenance database in access and want to make some changes that will make the database more flexible.
What I have is a main form which has the following main fields from the tblWorkOrder; WorkOrderID, FleetID, StartDate, FinishDate, Odometer, and ServiceTypeID.
Within this I have a subform in datasheet view (tblServiceItems, fields; ServiceItemID, ServiceDescription, ServiceCompleted(checkbox)) and this lists all the service items that belong to the ServiceTypeID in the main form.
I have another table called tblServiceDetails and this has the fields WorkOrderID, ServiceItemID which join the above two tables.
My problem is that I can't get the subform to list all the records that are in the table tblServiceItems, it only shows each record if you go through and select it manually. What I want it to do is to show like a listbox and allow me to go through the list and check of those service items once they have been completed. On top of this I want all those service items for that service type to be recorded against that workorder (regardless of completed or not) so then when I create a report on a WorkOrder It will list all the service items showing the checkbox's of which services have been done.
I've tried to do this with a listbox, but It doesn't show the checkbox, only yes or no. I've also tried using the tblServiceItems as the subform but this only updated the table and didn't create a record in the table tblServiceDetails matching it with the workorder.
I am experience brain flatulence and need some remedial assistance.
I am creating a data entry form. I have envisioned a tabbed format because I will have this idea utilized for Placement, Mentoring and Seminars data entry as well as recruitment. But I am open to other methods. Here is a description of what I have...
tblTeachers (this is the ONE)
Demographic data
tblRecruit (this is the MANY)
recLocation recMethod recYear recSchool
Form =================
List of teachers available to allow a user to see who has already been entered to prevent duplication Use this same list for navigationrecord navigation
The problem I have is this:
I have created a tabbed control that has the data entry fields I have created a subform to display ALL teachers from tblTeachers I do not know/remember how to link these so that the list may be used to to display the select record in the tabbed control
i am using a form like form customer orders in northwind 2003 database. in my form there are 3 sub forms.data of subform1 will be filtered by one of the field in the main form.subform2 will be filtered by one of the field in the subform1 and ...
also i have added some code for highlighting current row of each form/sub form , now my problem is when navigate thorough records of main form by using navigation button , showing each record after pressing navigation button is a bit slow (it takes 5 seconds), problem is from subforms or codes for highlighting current row?
I had set Data Entry to True in order to always default to a blank record. However that locked up my ability to use the arrows to navigate between records in the database. Is there a work around?
I want a user to be able to create a new record in the main form, after they have finished filling in the boxes in a subform by pressing the Enter key, rather than having to click the 'new record' button on the main form.
I reckon I need a 'default button' on the subform but I have no idea what this should do when clicked to create the new record...
I'm having difficulty controlling data entry to (disabling) a subform when a new record is being added to the parent form. I can set the subform to be disabled if there is no index value in the parent form (this allows the subform to function for existing records) but then the user has to create the parent record and move off of that record and then return to it in order to add child records to the subform. This is basically a create new records/data entry problem and I'm feeling pretty stupid. There must be a way to handle this...
When I click on the command button to create a New Record and then type the customer details in the Main Form and the Order Details in the Subform, the information is not retained
i.e. when I close the Form and then re-open the Form the orders details are not saved but the customer details are.
When I re-enter the order details the information is retained this time, everything seems work ok second time round!!
I am trying to create a database to manage IT assets, most of the structure is done, I'm now trying to get the details done.
The issue I am currently trying to tackle is to get a control button on one form to create a new record in the sub form that sits in the main form via another pop-up form.
So I have :
>PeripheralsViewForm - that has 4 control buttons (Edit Quantity, Edit Description,Add an Item and Exit)
>> PeripheralsSubForm - (Datasheet) which is referenced to PeripheralsQuery
The Edit Quantity and Edit Description open a separate form which allows the user to update only the quantity or description respectively (I have done it this way rather than allowing edits in the data sheet as I feel that it is too easy to hit a key incorrectly and overwrite data in the datasheet view) Both of these functions work perfectly (to my amazement) - I am using the id field in the subform to link to the pop-up form which then has unbound text input boxes, which I then write back to the subform.
e.g from edit button on click event: DoCmd.OpenForm "perquantform", , , " ID=" & Form.PeripheralsSubForm!ID and then from the pop-up form "perquantform" on the "Exit & Save" button I have :
This allows the user to select the record in the datasheet form and then click either the change quantity or description button.Also also the other reason I did it this way was because I just couldn't get the subform to requery when I had the two edit popups linked to the table or query.
The problem now is that when I click on the "Add an Item" button, it overwrites whatever record is currently selected !
The code I have is this:
From the "Add an Item" button on click action: DoCmd.GoToRecord , Forms!peripheralsViewForm!PeripheralsSubForm.Form! , acNewRec DoCmd.OpenForm "addperform"
And from the form "addperform" - "Save & Exit" button on click action:
the line "DoCmd.GoToRecord , Forms!peripheralsViewForm!PeripheralsSubForm.Form! , acNewRec" is what I have added to try to solve the overwrite issue, but when I run this it comes up with the error :
"runtime error 2498 - An expression you entered is the wrong data type for one of the arguments"
I have put this line in the "addperform" exit action and it comes up with the same sort of error.
I'm trying to create a record for a table that has 2 attributes:
ContainsTracks +album +tracks
I have my main form, where the album is determined by a TextBox. My subform has a textbox that lists the tracks (in datasheet view). I have this set up and working fine.At the moment if I try to add a new record by typing a new entry into the subform I get the error: "Index or primary key can not contain a null value". This is because both album and tracks make the composite primary key of ContainsTracks.
My question is, how can I tell the subform to grab the value from TextBox1 in the main form as the +album when I create a new record.I have provided two screenshot that perhaps explain my predicament a bit better
What i'm trying to do is add a new record to a subform. The problem is, I couldn't use a subform based on a table in order to achieve this. I needed extended information for it to be useful, so I made the visible part of the subform based on a query instead.I'd like to add a button that adds a new object to the main job. I'd like the adding of that button to call a new form allows you to fill in the information for that object (this called form actually contains 5 subforms to populate all the data of the object). That form works.
What I need is for the button to call the 2nd detailed form AND create the necessary entries in the project/object junction table.The idea as it is now is a button on the main form, but if it was possible to do so via continuous form in a subform, that's doable.
I have an "Returns" master form that contains two subforms. The subforms contain items that we are returning back into our inventory. The underlying queries in each subform show only those records where the "Return Date" is null. The query(s) works fine, except that if there are 3 items that need to be returned there are 3 records that show in the master Returns form. I tried the Totals option in the query but the I need that Return Date on the subform. I only want one Returns master form to show the 3 records (not 3 records of the same master form).
I am new to Access and I am trying to make a Database. However, I have an attachment with each record and I would like to know if there is a way of making a button/link that will allow the user to navigate from each record to its respective attachment.
I'm trying to navigate to a record based on a series of combo boxes and a button. The user goes through the combo boxes, first picking a (let's say) Store, then Aisle, then Item. The Item combo box stores the Item's unique ID as its bound column.My code is as follows:
Code: Private Sub NavigateButton_Click() Me.Recordset.Clone.FindFirst "[ItemID] = " & Me![ItemComboBox] Me.Bookmark = Me.Recordset.Clone.Bookmark '(<-- Don't actually have this in yet, but I will need it) End Sub
The ItemID field in the ItemTable table is an Autonumber Long Integer. Why am I getting the error "Engine does not recognize 'ItemID' as a valid field name or expression"?There are no references within the form to the ItemID directly (no text boxes, hidden fields etc).
I've been working on a database for work for the last few weeks and this forum has been a Godsend many times over, but now I have a problem that I can't find any reference to.
Using Access 2003, I have a form that uses 3 cascading combo boxes in the header to find a unique record, and a command button that brings up the rest of the record into unbound fields in the body of the form.
It works fine for finding records, but whenever I enter/change data on it, the record doesn't save. The navigation buttons at the bottom don't work - the Next/Previous record buttons are disabled, and the First/Last Record buttons do nothing.
Navigation buttons are enabled/activated in the properties.
I tried getting around this by creating a Save Record command button - first using the wizard, then using VBA code DoCmd.RunCommand acSaveRecord as advised by [missinglinq;696351], but this still doesn't save the changes.