I'm terribly sorry to bother on what seems like a very simple matter, but I've just given up on MicroSofts documentation.
I just want to execute the Shift+enter type of save-record command (also available from the "Records" menu at the top) when a field loses focus. This would need to be part of my VB code as I'm doing other things on this event as well.
I have a subform with records of call details (date, time, subject) - the date and time are autogenerated and subject is a text field. After entering text in the subject field and then clicking on the close button in the main form, or clicking anywhere else in the main form, the record is saved to the table. However, if I enter text in the subject field and then move up to view previous records (within the subform) and then click the close button in the main form the record is not saved in the table. How can I either save the record before allowing the user to move to another record within the subform or before exiting the subform set the focus to the new record so that it will be saved on exit?
Iam very new to ACCESS. So please do forgive me for believing that the "SAVE AS" function in ACCESS is as easy as something similar we do in Microsoft Word.
After searching this forum and others I realise that there is no easy way and it is considered as some thing for serious users. (with additional coding not available in ACCESS) Perhaps there are easier ways that I am not aware of.
I would like to open a record in a FORM which has one Combo Box for text data, several text and Numeric fields. I then need to change a few items and save the record as a New Record Only a few (mostly numeric fields) and some date entries will be changed as well as a couple of calculated fields in the NEW RECORD.
I shall appreciate any suggestion as to how to do this.
Hello, I have a form and I have a button so people can open records to load into the form. The problem is that whenever they close the form it updates the information in the table. How do I stop that from happening? I want the information in the table to update only when they hit the button I made (which works).
And how do I stop it from loading the record when I open the form, or maybe I can specify to load a blank record instead, how do I do that?
This should be an easy one...I would like to save a record part-way while filling out a form. I know this can be accomplished by pressing Shift+Enter, but does anyone know the vb code for saving a record while working on a form?
I have several FE's each saving in their own BE. They are all the same but for different areas of our business. Each has around 20-30 users. I recently introduced another form into the FE that has linked tables to another different BE in another folder. Each FE out there with its own BE now has this form and all of the new forms save to the same (one) BE. Ok, got it?
Now, sure its possible to have them all together and I would anticipate someone suggesting this. Its split up to keep sizes down and performance up among other reasons.
In any event, here I am. All of the new form introductions went smoothly without a hitch. The last one however is causing trouble. On submit an e-mail is sent, the user is asked if they want to submit another form, and if yes a new record is created. If no the form is closed.
E-mails are always sent, no problem. The trouble is saving the record. All except one of the different FE's I have out there in different folders save the record into the table just fine. There is one though that does not do this. The mail is sent and the program behaves normally with no errors but the record is not saved. This does not happen to all users of this FE either. There are some users that work fine and the record is saved in the BE yet other users do not save the record. You can see the .ldb appear and disappear. Our IT dept has been through the permissions time and time again and tell me they are ok. The FE and main BE are in one folder while the BE that the new form talks to is in its own folder. Remember, this works fine for several other instances, its just the one that doesn’t save the record.
I did have a chance to see the permissions the other day and it seems a mess to me. They have users in individually, as they were set up initially and the same users are also in there in a group and maybe 2 groups. The permissions look a mess to me… they really do…. but that doesn’t necessarily mean they would not work and can be blamed. I have no control over this part and it drives me nuts!
What I have done...... copied a working FE from another area into the troubled folder. No good. I have removed the new form along with its linked tables and the record is saved. Put the form and linked tables back in and it stops saving again. The code compiles just fine. I have done compact and repairs.
Any thoughts or ideas out there??? If you need more info ask. I understand what I wrote but you might not LOL
does anyone know the code to save a report with a changing file name?
here are the details. i have a reoprt that changes weekly. i want to save a weekly file with the end result to be called "Downtime Cost Report #/##/##", where the date is pulled in from a qry called "qry_Actual_Costs_Thru" and field name [Fiscal Week].
i want to have message box asking "Want to save the record or not" to save the record.
form contain the subform also. i read some thread regarding that issue they suggest i have to use form's beforeupdate property. i used it for the main form but message box is appearing before entering the values in subform. i mean i have to enter some data in subform also.
i am attaching database for ur references. after entering PO nunber PO date and selecting client message box is apearing but it should be come after updating data in subform i.e. details.
The uploaded database has two main forms. The first is used to enter customer data, the second runs from a query and shows all those records that have been completed in the first form (frmCustInfo - AgentLog = Yes) but not completed in the second form (frmControlsSource - AnalystLog = No)
Then more data is input into one of the subforms (frmControlChecks). Now in order for me to see the results of the queries connected to two other subforms I have to move off the record and back to it (for the record to be saved and then the queries run)
After moving back to the record, the query results on the right (Information Only) are manually added to the last subform 'Input Two', then the user would move on to the next record and do the same. ------------------------------------------------------------------------------------------------------------- What I need it to do then is this: When the user tabs off the last field in the subform (frmControlChecks), the queries to the right (two subforms) would run, showing the results and also populating the last subform (frmAnalystInput)
The user would then click AnalystLog and move to the next record.
I hope this is possible without redoing the forms/queries because it's taken ages to get this far
I've also added info in this sample database and some working data if you want to take a look...thanks for any help
Good morning all! I've got three bound combos set to visible = false on their property sheetsThese will remain hidden or will be revealed depending on the selection made in another bound combo cmbType.
The select case below works fine on the form but the selection affects all records not just the current record. Open record 1 and select "compliment" from the first combo - the three others correctly stay hidden. Move to record 2 and select complaint and the combos appear - Great! Move back to record 1 and they're showing there as well. Groan. Helllllppp!
Private Sub cmbType_AfterUpdate() On Error Resume Next
Select Case cmbType.Value Case "Complaint" cmb2Day.Visible = True cmb15Day.Visible = True cmbOver15.Visible = True
I want to save a record with a command button. I am using RunCommand acCmdSaveRecord. Access gives me a prompt saying "You are about to update 1 record. Are you sure you want to update this record?"
I'm posting this question to Forms forum because I'm sure I can't do this with a report--though a report is really what I need to be using.
My database has buttons on the forms to preview a "page printout" report based on the data in the record displayed. The reports - formatted to closely resemble printed questionnaires provided by the client - are based on queries, run with criteria conditions to match the record on the screen. So, to run the report, you have to have queriable data -- i.e. the data shown in the form has to have been saved to table. So the print preview buttons include a Save command.
The client would like to be able to view the printout of a potential new (or changed) record without saving. (There is an audit trail that tracks changes and deletions once a record has been saved.) The only way I can think of that this might be done would be to print directly off of the form--which would produce un-pretty results at best, I'm afraid, and seems like a headache to set up. But would it even work? Using the file menu to preview printout of a form seems to save the record.
So, my questions: 1. Is there something I'm missing such that I could run the reports without saving the data? 2. If I DID print out the form instead of the report, can even THAT be done without saving the record? (They would only need to preview without saving, not actually print.)
I have a field on a form [vin] that is based on a table, except i changed control source to a Dlookup to pull the vin number in from another table so i wont have to type it when i enter the record. However, this field is not saving when i save the record. I cannot just make a relationship because we reuse the same vehicle numbers, when we sell van 1 with vin 123, and replace it with a new van with Vin 456, we still call it van 1, so the unique vin is the only way to distinguish the two.
I have to save the hyperlink of the copied file into a record of my database.
Private Sub Knop29_Click() Pad = "C:" Dim Bestandslocatie As String Bestandslocatie = DLookup("[Waarde]", "tblInstellingen", "[Tag] = 'Locatie'") With Application.FileDialog(3) .Title = "Bestand selecteren"
[Code] .....
The column where the hyperlink of the copied file has to come is "data".
As you can read the code i tried to do it this way: Me.Data.Value = NewName, but then i only get this pad saved into my database:
I want to have a box with yes/no choices defining the Lessons a Student chooses. Sth like this Because the Lessons are quite plenty and they change from time to time, I don't want to have them predefined in the Sudent table, but to have a related table containg the Lessons providing more flexibility. My problem is how to assign the Yes/No values from the form to a single record. ANy suggestions? A first thought is to create a List from Lessons table, with 2 columns. 1st the Lesson and 2nd the Y/N box. Every Lesson would have a value like this: 1,2,4,8,16,32,64... With this way the sum of the Lessons would be unique for each combination and it could be saved in a single record. But such a solution is not so practical. Any alternatives?
I have a form frmAddNewProject that is a Data Entry form.When you click Add Project on the form, it creates folders and copies files to a location and also creates new record(s) in the ProjectT table with appropriate information.Here is my code:
Code:
Private Sub cmdAdd_Click() Dim FSO As Object Dim FromPath As String Dim ToPath As String Dim FolderPath As String Dim strType As String Dim strYear As String Dim strGPN As String
[code]....
Everything works fine till here. Now I would like to close the form but closing it gives me an additional empty record.
Code:
Dim ctl As Control On Error Resume Next For Each ctl In Me.Controls ctl = ctl.DefaultValue Next Set ctl = Nothing
to remove all values, but then it just adds an empty record.Is there a way to close that form without removing my legitimate new records and without adding empty ones?
I have a form I would like to close without saving the record using a button. here is the code I have but it closes the form and it also writes the record to the table.
Code: Private Sub ClosewoSave_Click() Cancel = True Me.Undo DoCmd.close DoCmd.OpenForm "frmMenu" End Sub
I found in a thread that Cancel = True would not write the record.
I have a form for meeting records. One text box contains meeting notes, which is linked to ntext variable (SQL linked table) on the underlying table. The database has about 40 users but this particular form get no more than 10 new records per day, not so much activity.
This is the problem: sometimes a user start filling a new record, fill the meeting notes, but when he saves the record the text box gets blank and the record is saved with null value in the text box. This happens randomly but not very frequently.
Sometimes frustrating because the text may contain a full page of text and then when the user save the record all the typing is lost! Text box is with RTF formatting. I suspect it has to do with the Ntext data type of the underlying table. Shall I convert it to varchar(max)?
Hi could someone point me in the right direction for this one,
I have a series of linked tabbed Forms. One of the Forms is mostly populated by Combo boxes which all work fine. My problem occurs when you go to add a new record and populate the form with the combo boxes but decide for some reason not to save the record but exit the form using the Close form command button or by using the close button at the top of the Form. Access seems to Save the record anyway. I have placed an Undo Cmd on the form to clear all text boxes which works fine but it does not stop a user from closing or exiting a Form by another means and stop them saving that incomplete record.
I would be grateful for any thoughts on how to solve this problem.
Having a problem when saving a record that has been edited and contains a duplicate field. Here is what I'm doing.
I have an existing record that is being viewed by the user. I have an edit button on the form that is displaying the record. When the user clicks the edit button I do the following
'User clicked on edit customer record
Private Sub CustEditRec_Click()
'Store current customer key in string so we can cross
'Set customer record test string so we can determine
'what the user is doing
CustomerRecStat = "edit"
' Go unlock the customer data fields for editing
UnlockCustomerFields
TxtCompanyName.SetFocus
'Go Unlock the customer editing buttons
UnLockCustomerAddButtons
'Lock the add, delete, edit buttons
CustAddRec.Enabled = False
CustEditRec.Enabled = False
CustDelRec.Enabled = False
'Go Disable the customer navagation buttons
DisableCustomerNavigation
txtCustomerKey.Visible = True
txtCustomerKey.Locked = False
txtCustomerKey.Enabled = True
'Set focus on the customer key
txtCustomerKey.SetFocus
'disable & hide the customer key combobox
cmboCustomerKey.Locked = True
cmboCustomerKey.Enabled = False
cmboCustomerKey.Visible = False
Exit_CustEditRec_Click:
Exit Sub
Err_CustEditRec_Click:
MsgBox Err.Description
Resume Exit_CustEditRec_Click
End Sub
The field which duplicate entries are not allowed in the table is txtCustomerKey. Now remember we are just editing a record NOT ADDING A NEW ONE.
When the user finished making the changes to the record we use the same procedure to save the changes as we when the user is adding a new record...here it is.
'User clicked save customer record
Private Sub CustSaveRec_Click()
On Error GoTo Err_CustSaveRec_Click
SaveCustomerRecord:
'Update the table data fields with the data contained on the form
'*** IF WE GOT THIS FAR WITH OUT ERRORS WE SAVED THE RECORD
'*** GO AHEAD & DISABLE THE FORMS VARIOUS FIELDS
'*** & BUTTONS ONCE AGAIN AS WE ARE JUST BACK TO VIEWING
'*** THE CUSTOMERS DATABASE
'Enable and unlock the customer key field
txtCustomerKey.Visible = True
txtCustomerKey.Locked = False
txtCustomerKey.Enabled = True
'Hide & disable the customer keycombo box
cmboCustomerKey.Locked = True
cmboCustomerKey.Enabled = False
cmboCustomerKey.Visible = False
'Set focus on the customer key field
txtCustomerKey.SetFocus
'Lock the customer fields
LockCustomerFields
'Enable the navigation buttons
EnableCustomerNavigation
'Lock the customer adding buttons
LockCustomerAddButtons
'Clear the record testing status
CustomerRecStat = ""
txtCustomerKey_AfterUpdate
Exit_CustSaveRec_Click:
Exit Sub
Err_CustSaveRec_Click:
'If the error generated was by a duplicate value.
'This can only be caused by the customer key as this
'is the only field which does not allow duplicate values.
'so warn the user of this duplicate value error and set
'the focus on the customer key field
If Err.Number = 3022 Then
'if user is editing a record
If CustomerRecStat = "edit" Then
'And the entered customer key has not changed
If Me.txtCustomerKey = EditCustKey Then
'Return to saving the record as the key is
'not really a duplicate
GoTo SaveCustomerRecord
End If
End If
Select Case MsgBox("This Customer ID was already located in the database. Click OK to enter a new Customer ID or Cancel to stop adding this record?", vbExclamation + vbOKCancel + vbDefaultButton1, "Duplicate Customer ID")
Case vbOK
Me.txtCustomerKey.SetFocus
Resume Exit_CustSaveRec_Click
Case vbCancel
'Go simulate undo record click
CustUndoRec_Click
Resume Exit_CustSaveRec_Click
End Select
End If
MsgBox Err.Description
Resume Exit_CustSaveRec_Click
End Sub
The problem is when the user is editing a record. The database assumes the txtCustomerKey is a duplicate in the table. However we are not adding a new record so the duplicate error is false. Its just that the txtCustomerKey is the same as the record being edited. Its not DUPLICATED its the SAME.....
Any help anyone? Sorry for the long post but I'm a strong believer in the more information the better when trying to solve a problem....
I have a popup called by a subform to add a new record or edit a selected record. I keep getting "Runtime error 32502". The value you entered isn't valid for the field "|"
I have no required fields and all the drop down related fields have the right value type in them (That I can find)The only "|" reference I can find is in the OpenArgs content below when I load the form. If I'm adding a new record I pass two fileds via the OpenArgs
Private Sub Command52_Click() DoCmd.OpenForm "AddDebtorPaymentFrm", , , , acFormAdd, OpenArgs:=Me![DebtorId] & "|" & Me![MatterId] End Sub
or if I'm modifying a record from the subform on click I
Private Sub Text38_Click() DoCmd.OpenForm "AddDebtorPaymentFrm", acNormal, , "[Transactions].[TransId] = " & Me.TransId, acFormEdit End Sub
Below is the Popup Load code
Private Sub Form_Load() If Me.DataEntry = True Then Me.VariableHeading = "Add A Debtor Payment"
I have a form that I need to use to add new clients to a table in my database, lets call it tblClients. On this form I have a combo box which, when selected, will drop down with the first and last names of all clients in tblClients, as well as their Client ID. Once you select a client from the drop down menu, it populates all of the fields in the form with that clients info (Client ID, fname, lname, address, phone number, etc. etc.).
I need two other things on this form: one button that will save or modify whatever current record is currently pulled up, and one button that will start the process for entering a new client, so basically it would blank out all of the fields and fill the Client ID field with the current number +1.
As of right now I have the form made and the combo box works, in that I have 3 dummy clients in the tblClients and when I select each client from the combo box it will populate the fields on the form with the info. I'm using some simple VBA on the combo box such as
Me.FirstName = Me.cboBox.Column(1)
and that seems to all work, but the problem is trying to save/modify data to tblClients. The only record in the actual table that gets modified seems to be the first record. For example, if I pull up client with ID #3 and change his address or phone number, what happens when I click to save the changes it takes client ID #3 record, overrides it with client ID #1, and then client ID #3 is the same as client ID #1 except with the old information. I'm not quite sure why this is happening.