Forms :: Stop Tab From Starting New Record In Form
Nov 13, 2013
I have created some control buttons using the built in functions of Access2007 and then using the script supplied here modified the control.
So far the controls can add new record, save record, exit form, open next form and close existing form, open previous form and close existing form.
My next question is when the user reaches the end of the form fields how do I stop the form from automatically starting a new record?
For example, I use the TAB key to move from field to field and when I tab out of the last field the form goes straight to the next empty record.
I want this to be a deliberate action performed by clicking the Add New Record button and not an accident of a key press.
The other thing is, how do I get the form to open with blank/empty fields and not at the first populated record?
Some of the data is updated frequently so the records need to be able to be edited but I need to prevent accidental editing of the existing records.
I am using Access 2013. I have a form with 2 subforms, each time the form is opened, the first record on both subforms are selected. Is there a way to turn off the record selector so no records are selected when the form opens?
OK so my situation is a simple 1 to many relationship where the main form has the primary key and the secondary input form needs the foreign key to be passed to it to link the 2 tables.
Say for example 1 Site has many sections (Plants). The main menu form can therefore select the Site and filter to another combo box containing the plants that are attached to that site. The user can then either edit the plant or add a new plant record linked to the site.
I have figured out how to edit the plant attached to the site using a macro that opens the form Plants with the site ID passed from the main form however when I want to enter a new Plant I still need the site ID passed to the Plants form however using the following code
i wonder if anyone can help with this problem i cant seem to work out.
i have a bound form linked to an orders table, including some required fields. when i use the navigation buttons of the form to scroll thorugh the orders i can get to the end where the form expects you to make a new order. but i have a button to add a new order.
i want to stop the user being able to go past the last record in the orders table. or enable them to get back to the last order. currently if the user goes past the last record (making a new order) there is no way to get back to the last record. using the navigation back button causes errors as the required fields are blank and access tries to save the order, thinking i want to make a new one.
i hope this makes sense.
i have tried setting the Allow Additions setting of the Form to No. but this causes problems when there is no data in the orders table. opening the form produces a blank form, showing no fields or buttons at all.
i would be greatful for any advice, maybe i am doing something fundamentally wrong?:confused:
i wonder if anyone can help with this problem i cant seem to work out.
i have a bound form linked to an orders table, including some required fields. when i use the navigation buttons of the form to scroll thorugh the orders i can get to the end where the form expects you to make a new order. but i have a button to add a new order.
i want to stop the user being able to go past the last record in the orders table. or enable them to get back to the last order. currently if the user goes past the last record (making a new order) there is no way to get back to the last record. using the navigation back button causes errors as the required fields are blank and access tries to save the order, thinking i want to make a new one.
i hope this makes sense.
i have tried setting the Allow Additions setting of the Form to No. but this causes problems when there is no data in the orders table. opening the form produces a blank form, showing no fields or buttons at all.
i would be greatful for any advice, maybe i am doing something fundamentally wrong?:confused:
I have a macro that opens up a form called SLA Complete Form - The macro then goes and examines two fields on the form to see if they contain data and if they do not then it displays a popup box with a message.
The form that gets opened up can have anywhere from one record to approximately a hundred records.
How can I get the macro to stop running when it hits the last record on the form without displaying an error message. I am currently using the next record feature in the macro.
I am building a student register for a school for disabled children. There is a screen listing all students, one showing detailed student data chosen by #=IIf(IsNull([ID]),"(New)","Open")# clicking on "Open", one listing all the guardians, choosing a guardian by #=IIf(IsNull([ID]),"(New)","Open")# clicking on "Open", to diaplay Guardian details.
From the student list, I select and view student details, including a pointer to their guardian details. After selecting the first student details, and then viewing their guardian data, any subsequent student details and guardian details updates the prior guardian data with the next guardian's data.
How can I prevent the successive guardian details from updating the prior guardian table when it is exited? I view the guardian details using ADO recordsets populating a form. When I exit, it updates the previous record.
How do you prevent access from adding a new record when u input data in the current record or tab to the next field? My database is set up to open with a form where the user picks his name and then a week ending date once that is complete u open a new form where the name and date auto populate along with other fields to fill out such as job charge, charge type , times charged for each day of the week. But I don't want access to create a new record everytime the person inputs or tabs..... .
I have a form that opens to a NEW record, all fine and grand. there are a few drop down choices, and modern users are using the scroll button to try to move up and down the list in the drop down boxes, but this action actually tries to move to the next record, causing an error as fields are blank etc (which is fine) but its confusing everyone.
the nav buttons are not shown on the form, so what can we do to stop the form trying to goto another new record?
the form is opened using a macro, where the action is OpenForm (view=form, data mode=Add and window mode=Normal) GoToRecord (record=new).....
I have some code (see below) that checks if the start date text box is blank or greater than the end date, and if so, generates a message box and sets the focus back to the start date textbox. There are command buttons on the form that open queries based on the date fields. This all works fine.
However, if the user changes his mind and closes the form without filling in the date field, the message box "Please enter a start date" pops up repeatedly. How do I specify that a text box is required UNLESS the user is closing the form?
Code: Private Sub txt_startdate_LostFocus() If ((IsNull(txt_startdate) Or (txt_startdate) = " ")) Then MsgBox "Please enter a start date.", vbOKOnly
I have a form in which user will enter few values but I need users to enter the comment in relevant text box too only if they have any non zero value.
I have attached an example for reference....where red encircled portion is for values and blue is for relevant comments. If value is non zero then user should be enforced to enter the comment too......system should not allow user to move forward or backward until there is some comment.
First I will open a form and choose a salesman. Then based on the salesman selected I want to open a recordset and start searching for the last record for the salesman selected. When the record is found some of the information from that record is pulled on the form.
I have a simple form in datasheet view in Company Name sequence. By default it starts the list at the beginning. I would like to put a combo box in the form header that pulls down the companies to allow the user to select the starting company to list. I don't want to go directly to the selected company, I just want the list to populate starting with the selected company. I can create the combo box and I know I use the After Update event to get the selected value, but how do I restart the list. Ideally, I would still like the operator to be able to scroll up and down after the list is redisplayed starting with the selected company.
Background: I have the foloowing tables tblClient: ClientID (PK) ClientName other client details
tblMachine: MachineID (pk) SerialNumber ClientID (fk to tblClient) other machine details
tblProduct ProductID (PK) ProductName
tblReadout: year_date month_date(pk fld1) day_date(pk fld2) ProductID(fk to tblProduct) MachineID(fk to tblMachine) ReadoutAmount
Question: I would like to build some kind of a form where the user will be able to enter data for readouts (ProductID, MachineID, readoutAmount, year_date, month_date, day_date), but I would like them to only be able to do that, I mean I do not want them to be able to modify any of the other data in the table or even see it, so only adding a record that is it. Also I would like them to be able to enter the ProductName instead of ProductID , how do I go around that ?
This is probably elementary, but I'm entirely lost. Here's my issue:As most of you probably know, when first creating a switchboard in a database will automatically create a form based on it.Somehow I managed to delete that form, and have no idea how to make a new one with the same default switchboard format (where command buttons are automatically generated, and there's a default title label with the shadow effect, etc.)I thought I might try to just delete the switchboard and create a new one so that another form would be created, but it won't let me delete the switchboard!If I understand correctly, I have to create a switchboard without any other switchboards already existing for Access to create a related form for me. Any suggestions?
I'm writing a course registration Db. I have a have 3 tables at the moment tblContacts [ContactID], [FName], [SName], [Etc..] tblCourseRegistration[RegID] [ContactID][CourseID] and tblCourses[CourseID] [CourseName] [Etc...]
These are all linked on a tabbed form. I have found that the same Contact can sign up for the same course twice. I need to stop this happening. Is there an easy way to prevent this or do I have to write a query that runs before the save command to prevent this?
I am writing a database with a number of tables with forms attached to each table. I have placed navigation buttons on each form to move to first, last, next, previous. I have set up the code associated with the buttons as "public sub" so it is available for each form to use.
This was working OK except that when I used the NEXT button at the last record it would open a new blank record & keep opening a new blank record on each click.
To over overcome this I put in an If statement to check if it had moved to a new record. To do this I used the following:
If Me!NewRecord Then ..... etc
Now I get an error "Invalid use of Me key word" I suspect it is because I am using ME in a public sub
How do I overcome the problem of moving passed the last record and still have the coding available to all forms?
The Code is below.
Thanks for any help.
Public Sub Next_Record_Click() On Error GoTo Err_Next_Record_Click
DoCmd.GoToRecord , , acNext
If Me!NewRecord Then ' If new record move back to previous DoCmd.GoToRecord , , acNext ' Send message MsgBox "This is the last record", , "No More Records"
I am on a Invoice Header record in a bound form. I want to stop the user from scrolling the mouse wheel down, and land into a new record.
The problem is that when a user moves the mouse wheel, he lands into a new record, and access skips all data validations in the first record, and just commits it. I want to completely disable the mouse wheel. I have disabled the pageup and pagedown keys, but don't know how to stop the mouse wheel from scrolling.
I am basically setting up a macro that will change the value for a field from "N" to "Y" for all records from a query. The macro works fine except for it does not know when to stop and gives an error message of "You can't assign a value to this object" after it has gone through all of the records and there are none left to change. The macro is set up like this:
OpenForm Action : This form is populated by the query and I set the Where condition to open records that don't already have a value of "Y".
SetValue Action : I use this to set the value of the field to "Y"
Close Action : I use this to close the form and save the changes
RunMacro Action : This is where the problem is. I use this to repeat the macro so it can go through the rest of the records that still have the field set to "N". I need to set the Condition or Repeat Expression so that it checks if all of the records have been changed. It either needs to check that all records have the field = "Y" or check that the macro is on the last record. Basically something that will cause the macro to not open itself again when there are no more records to be changed.
I have to add an Input Mask or force the user to enter in a specified format in a text field. The condition is, text should start with "A" or "T". The complete format is A-12345-67890 or T-12345-67890.