Vba Code For Saving A Record

Apr 13, 2006

hola,

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 know it is something like:

DoCmd.Save acReport, "Downtime Cost Report"

Thanks
T

View Replies


ADVERTISEMENT

Vb Code For Saving A Record

Feb 22, 2006

Hi,

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?

Thanks.

View 1 Replies View Related

VBA Code Doesn't Work After Saving In ACCDE

Oct 2, 2014

I saved my front end db as .accde in order to distribute it without user being able to edit my objects. As it turned out, when I open the .accde now I see my code doesn't work anymore. I have a lot of startup code and now it doesn't trigger at startup. Basically all my forms use vba code and none of them works in .accde . Accdb version works without any issue.

View 3 Replies View Related

Forms :: Saving New Record When Moving To Another Record In Same Subform

Jan 17, 2014

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?

View 4 Replies View Related

New Record On Saving

Apr 5, 2006

Hello guys

I have one small quick question. How can get blank or new record after saving

Cheers

View 3 Replies View Related

Saving A Record AS A NEW RECORD From A Form

Nov 23, 2006

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.

View 13 Replies View Related

Saving A Record On Lost_focus

Jun 26, 2006

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.

Any help is greatly appreciated.

View 1 Replies View Related

Saving Record From Form

Feb 23, 2005

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?

Thanks in advance!

View 1 Replies View Related

Record Saving Woes

Mar 16, 2006

Ok, here is my scenario.

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

View 8 Replies View Related

First Row Is Blank When Saving A Record

Dec 9, 2012

Please find attached table

When saving a record first one is blank row how to solve. For the first time only it happened why? How to solve.

View 6 Replies View Related

Message Box For Saving Record?

Dec 28, 2011

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.

View 5 Replies View Related

[B]How To Stop Access From Saving The Record When The[/B]

May 25, 2007

Hi

I need to know how to stop access from saving the record when the
subform query is on focus?


Thanks

View 5 Replies View Related

Saving Record To Run Query & Update

Jun 14, 2005

Hi all,

I've got this form working ok but need to add some extra functionality but haven't a clue how to do it!

http://www.access-programmers.co.uk/forums/attachment.php?attachmentid=10175

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

View 1 Replies View Related

Combo Box Selection Not Saving Record

Sep 5, 2005

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

Case "Compliment"
cmb2Day.Visible = False
cmb15Day.Visible = False
cmbOver15.Visible = False

Case "Suggestion"
cmb2Day.Visible = False
cmb15Day.Visible = False
cmbOver15.Visible = False

End Select
End Sub

View 1 Replies View Related

Saving Record Without Access Prompt

Mar 13, 2006

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?"

How do I get it to stop prompting me every time?

View 1 Replies View Related

Print Preview Without Saving Record

May 15, 2006

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.)

View 3 Replies View Related

Forms :: Table Not Saving A Record

Jun 19, 2014

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.

View 3 Replies View Related

Saving Hyperlink Into Record Of Database

May 22, 2012

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:

hns019afdelingafd_tdHasseltOpslag documentatie TDMaxihalKranenKraan24TraverseSoftware

So i need to find a way to past the file name after this link so that it becomes something like this:

hns019afdelingafd_tdHasseltOpslag documentatie TDMaxihalKranenKraan24TraverseSoftwareFile.exe

View 1 Replies View Related

Saving Multiple Values To A Single Record

Oct 22, 2005

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?

Thnx in advance

View 1 Replies View Related

General :: Modifying Record And Saving In New Location?

Dec 4, 2013

I'm working on a database that will be used by two different groups. Group A provides a list of items to be investigated by Group B.

I'm wondering if it is possible to:

i) have Group A create an excel file of items to be investigated (let's call the file tblNEW)

ii) open a record in the file through a form (let's call the form frmINPUT) to allow Group B to input investigation findings

iii) save the modified record into a separate table of all the work that has been done (let's call this table tblWORK)

iv) delete the investigated record in tblNEW once it gets saved into tblWORK

View 1 Replies View Related

Forms :: How To Close A Form Without Saving A New Record

Feb 28, 2014

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?

View 4 Replies View Related

Modules & VBA :: Close Form Without Saving Record

Jun 3, 2015

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.

View 4 Replies View Related

Forms :: Text Box Get Erased When Saving Record

Feb 13, 2015

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)?

View 14 Replies View Related

Exit A Half Populated Form Without Saving Record

Feb 27, 2006

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.

Thanks in advance

View 4 Replies View Related

Duplicate Data Error While Saving An Edited Record

Jan 8, 2005

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

'check if user has changed the key during edit

EditCustKey = Me.txtCustomerKey

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

'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

CustomerKey = Me.txtCustomerKey

CustomerCompany = Me.TxtCompanyName

CustomerFirst = Me.txtCustomerFirst

CustomerLast = Me.txtCustomerLast

CustomerAddress = Me.txtCustomerAddress

CustomerCity = Me.txtCustomerCity

CustomerProvince = Me.txtCustomerProvince

CustomerPostal = Me.txtCustomerPostal

CustomerCountry = Me.txtCustomerCountry

CustomerPhone = Me.txtCustomerPhone

CustomerFax = Me.txtCustomerFax

CustomerEmail = Me.txtCustomerEmail

CustomerWeb = Me.txtCustomerWeb

CustomerNotes = Me.txtCustomerNotes

'Save the record

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

'*** 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....

Thx

Kao

View 1 Replies View Related

Forms :: Saving A Record And Closing A Popup Form

Jun 15, 2014

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"

[code]....

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved