I'm working on a project that has project start / end dates which can change. A report is created based on this data. The customer wants me to save all changes as a new record and disregard the older record when the report is created. I was thinking that I would add a (yes/no) column that marks the new record as the most recent (yes) and marks older records as (no). Then I would modify the query for the report to only include records with 'yes' set to true. I was also thinking that I should create a second table that has a foreign key for the original record from the main table. The main table would have the most recently edited record while the second table would have the previous records. Which method should I use?
I have a database / form with a hidden timestamp field [LastEdit] that is filled automatically with the current time Now() when updated. The purpose is that each time the form is opened I want it to "Goto" the last edited record.
I *think* I get around the find edit quotes because the smaller snippets below do work.
But the whole thing fails when I put it into one command as either one of these DoCmd.FindRecord DMax("[LastEdit]", "esn"), , , acSearchAll or DoCmd.FindRecord findit, , , acSearchAll perhaps because of the quotes around the variable.
I have a problem that should have an easy solution. But I can't find it.
I need to have a user add a new record. (Created a form with the fields on it, No problem , so far.)
The problem is when the user is adding a new record if they hit the PAGE DOWN Key or the mouse scroll, they then go to a new NEW record. (And if they are not paying attention they now have two new records)
I have a form where a user can change the scheduled start date for a job. On a sub form on the same screen is a list of notes relating to that job.
Any notes added, automatically have todays date and are locked when the user clicks off.
When the scheduled start date is changed I need a note to be made. Either forced, then entered by the user or automatically.
I was thinking of making the scheduled start appear in a small form and the button to make it come up could add a new note on the click event (possibly in a message).
Or even better (probably harder) any time the value is changed in the form a new note is added.
Other options could be a pop up form to add one note on a change.
I have a continious form where each record can be edited. After editing a record the form does a me.save and a me.requery (is important). After this it jumps back to the first record (seems logical), but how can I write a code that he goes back to the 'previous edited record'.
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....
Hi All, I have a form that when loads, runs some VBA on the "On Current" event. Some of that code, fills in text boxes, with concatenated (?) strings. So every time I use the record selector and get to the end of all the records, the "On Current" fires adds the concatenated string (even if it's empty), and that then becomes a new record! Is there some way i can prevent this, but still keep the "On Current" event, some type of logic I could run before the concatenations etc.
Well from reading the forums i have learned alot about access but now i am stuck and can't find what i am looking for.
I am building a database basically to track the Software bought for our company.
I have my Application table and my purschased table. The relationship between the two is ApplicationID.
What i need is to be able to do is look up the ApplicationID and then have that vaule be added to the new purschase record. My method of doing this was to created a form with 3 list boxes and 1 text box (not viewable). The list boxes are Company, Application, Version. The text box is the returned ApplicationID.
The list boxes dynamically adjust based on your selecetion to find the vaule of the 1 text box "ApplicationID".
Once you have selected the application you want to add as a purschase i have a button to open the Purschase form. I have everything that needs to be filled out in the form. My problem is getting the vaule of ApplicationID in the purschase form for the new record.
My problem;
Right now when the Purschase form opens it as all the data and the ApplicationID is shown as being correct but not selected. Right now the user would have to manualy select the vaule for the data to be commited to the record.
How do i selected a record so the data is submittied and a new record is started, on open, then set the focus onto a new field. This way the user does not have to do it manually.
Hi, I have a Edit Form, where users edit the customer information. I want to add a Button which creates another copy of the same record in the table. How Can I achieve that? any suggestions? Regards -KJ
I have a table called [Tasks] which has the following relevant fields:
[Task ID] [Location]
I have a form that people use to create new tasks and update current ones. Location on the form is a combo box where people can pick from 5-6 different locations.
After someone selects a new location from the combo box and changes the task location, I want to create a new record in a table called [Task Progress] with the [Task ID] of the task whose location was changed, the new [Location], and the [Date] and [Time] it was changed. It would look like
Code: [Progress ID] [Task ID] [Location] [Date] [Time] 1 5 Station 1 1/1/2011 12:13:01 2 8 Station 2 1/3/2011 01:53:29 3 5 Station 2 1/5/2011 11:13:05 4 5 Station 3 1/6/2011 12:35:22
What should I put in the AfterUpdate event for the [Location] combobox to make the above happen?
Note: All my tables are ODBC linked to SQL Server (can't use data macros).
I have a form with information on it relating to several linked tables. I would like this information to be duplicated in the tables and a new autonumber assigned.
Is there a way that I can do this by clicking one button and the autonumber will automatically generate a new number keeping the rest of the information in the form and updating the tables with a new record?.
hello, I have form "QUOTE" (which has a check box "GenerateOrder") and form "WORK_ORDER". Once I click on "GenerateOrder", I want form "WORK_ORDER" to open, and I want to assign a value from a txtBox in form "QUOTE" to another txtBox in form "WORK_ORDER" creating in this way a new record on form "WORK_ORDER". I want to make clear that as soon as the value is passed or assigned to the txtBox in form "WORK_ORDER", a new record for this form should be created.
I tried this code:
Private Sub GenerateOrder_Click() If (Me.GenerateOrder.Value = True) Then DoCmd.OpenForm (WORK_ORDER) [Forms]![WORK_ORDER]![QID] = [Forms]![QUOTE]![QID] 'assignment End If End Sub
I am trying to create an alert function so that when a user open up a form and displays a record, it will also display any alerts that have been created for that record. e.g. missed payments etc. I have created a table to store the alert data along with the job number to which the alert relates so in essence I can have more that one alert per job record. I amtrying get one of the alerts to display ok using the following code
You will see that I am trying to only display alerts that are within the valid date range (I have not yet included [End_Date] as I cannot get the code above to work.
Can anyone help me correct this code please?
The other thing is that because I am using a dlookup, I am assuming it will only display the first alert it finds in the table and that's it? If so, how do it get it to display all 'active' alerts with a matching job number. By active I mean where the Start date is >= Date() and End date is <= Date()
I am trying to put a spreadsheet on a form that will allow me to enter data on the spreadsheet and store the information for each record.
Example: I have patients that I am using a combo box to bring up their name and address information. I want a spreadsheet tied to each patient that I can keep a running total of their payment history. Is this possible and How? Thanks for your help!
I have a table called [Tasks] which has the following relevant fields:
[Task ID] [Location]
I have a form that people use to create new tasks and update current ones. Location on the form is a combo box where people can pick from 5-6 different locations.
What I want:
After someone selects a new location from the combo box and changes the task location, I want to create a new record in a table called [Task Progress] with the [Task ID] of the task whose location was changed, the new [Location], and the [Date] and [Time] it was changed. It would look like
Code: [Progress ID] [Task ID] [Location] [Date] [Time] 1 5 Station 1 1/1/2011 12:13:01 2 8 Station 2 1/3/2011 01:53:29 3 5 Station 2 1/5/2011 11:13:05 4 5 Station 3 1/6/2011 12:35:22
What should I put in the AfterUpdate event for the [Location] combobox to make the above happen?
Note: All my tables are ODBC linked to SQL Server (can't use data macros).
I have an access database that I use to manage my car dealership, part of it holds data of a stock vehicles, another aspect is invoicing.As part of the invoicing form, I have a part exchange vehicle section which creates a new record in the part exchange table.
What I would like to be able to do is when a new vehicle is added to the part exchange vehicle table it automatically adds it to the main vehicle table so it shows as a stock vehicle.
Hello all. I've tried searching the forums as well Google for an answer for my problem, but perhaps I'm not searching on the correct key words. Would someone please point me to a post that addresses the below issue. My company has a customer service (CS) application where our CS agents document CS requests. For reporting purposes, they drop a text file containing open service requests that I then import in Access 2003 so I can analyze the data. I've had the vendor use È (ALT+0200) as the delimiter and double-quotes to enclose text. This has been working well until the application vendor upgraded the app last week. Now, whenever a user hits the [Enter] key to create a new line in the comments section of the application, a new line is created during the import process into Access. When I view the text file I can see the Enter Character because it is displayed as (except it looks more like a rectangle standing in its short side.) I thought if creating a macro to run on the text file to delete the enter characters, but I can't find a way to systemically find the character. So far, the only solution on my end is to manually delete the characters, but that's unrealistic because there are thousands of records. Thank you in advance for pointing me to a helpful post or commenting here. Stephen
I have a form. In that form I want to display a series of dates from a database table..ex. 12/15/2004, 12/16/2005, etc... Next to those dates I want to have a checkbox. The user should be able to click on that checkbox if they want to sign up for that date. So there could be more then 1 checkbox checked, but there will always be atleast 1. So my first question is, how do I make this work. I've tried several things and everytime I check on the checkbox it checks all of the checkboxes.
PLEASE HELP!
Subject 2: Regarding the above question, how do i reference those dates that I've checked the checkbox next to, to put into another table?
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...
One scholarship can be awarded to only one volunteer. I have a form to enter all the volunteer information. At the bottom of the form, I would like to place a button to open a new form to award a scholarship to this volunteer. I believe I need to link the forms in the following manner:
VOLUNTEER.volunteer_ID = SCHOLARSHIP.volunteer_ID
The problem is this: The forms are not linked properly because in order to assign a volunteer to a scholarship, the scholarship must already exist. So when I click the button to open the scholarship form, the scholarship form is empty and the volunteer_ID defaults to "0".
I think this could be fixed by somehow making my button create a new scholarship_ID in the scholarship form and THEN linking the volunteer_ID fields.
Does this seem like a solution? If so, how would I implement it? I have a screenshot to help. Thank you in advance for your help.
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...
i have this problem that is bugging the crud out of me: sql="UPDATE bedrifter SET pr=" & Request.Form("pr") & ",totalindexedpages=" & Request.Form("tip") & ",totalinboundlinks=" & Request.Form("til") & ",description='" & Request.Form("dsc") & "' WHERE created='" & Request.Form("ts") & "'"
conn.Open connStr conn.Execute(sql) conn.close() Set conn = nothing
when i run this code it updates the correct record (line in my access db) but then it also adds a new line with only that info in the update query. why is it doing this? when i update using the ID instead of using the timestamp in the WHERE clause it works fine. really frustrated...
how to use the Like statement when creating a record-set of data through VBA. Before I was always able to find work-arounds but now is the time to slay this issue once-and-for-all.A person can build several sales quotes for a specific company and I am trying to find the last sales quote that was built. The function is passed a variable length string and I am trying to build a recordset of all quotes based on the variable. Here is the offending line of code:
strSQL = "SELECT * FROM Quotes WHERE Quotes.ProposalNo Like " & "*" & strProposalBase & "*" & " ORDER By Quotes.QuoteID DESC" (This yields an empty recordset)
strSQL = "SELECT * FROM Quotes WHERE Quotes.ProposalNo Like ""*" & strProposalBase & "*"" ORDER By Quotes.QuoteID DESC" (This yields an Error message stating there is an invalid column name)
strSQL = "SELECT * FROM Quotes WHERE Quotes.ProposalNo Like " & strProposalBase & "*" & " ORDER By Quotes.QuoteID DESC" (This yields an Error message stating there is incorrect syntax near the word ORDER)
I have tried different variations above and beyond these strings and get one of the three listed errors.
Not sure if it's possible but I'm trying to create individual calendar's for each staff member and client to put availability and bookings on to them. I've tried using the active x control but it's not really what I want, not sure how else to approach this as my access skills aren't that great.
I have a table that deals with current data (as in member rentals of items). The normalized tables that we have been given include a rental history table. The idea is that, when the member has returned the product a history entry is made in the completed rental table.
I wish to have a button which is clicked to triggers this event. Would I program a macro to do this? In other words, would I create an event that passes those values to the relevant fields in the other table (Name, date issued, return date etc)?