General :: Adding New Preset Record Into Second Table
Feb 26, 2013
I was trying to further my knowledge of access. I have a database that is suppose to be used a s a simple budget database.
Form: StartingAmount
Table: StartinAmount
Field: StartingAmount
Button: Create
Form: Transactions
Table: Transactions
Field:
TransactionDate
TransactionName
TransactionAmount
When the database is open the form StartingAmount is open (only until a starting balance is entered.)
User then puts the starting amount in. clicks create.
Then a record is added to Transactions.
TransactionDate = Date entered (auto populate)
TransactionName = Starting Balance
TransactionAmount = StartingAmount
I tried this code:
DoCmd.RunSQL "INSERT INTO Transactions (TransactionAmount) " _
& "VALUES(" _
& "'" & Me!StartingAmount& "') "
With this it kept giving me an Append error and Im not sure how to get it to stop and how to add all the fields needed.
I tired to do:
Code:
INSERT INTO Transactions([TransactionName], [TransactionAmount])
VALUES ("Starting Amount", Me.StartingAmount)
But i keep getting an expected error in the VBA side.
View Replies
ADVERTISEMENT
Aug 23, 2014
I need to add only one record into a database by using a mask.
For sure when I call this mask via a button, this new record has to be added after the last one.
Someone is suggesting me to use function docmd.openform, but I really dont' know how to do it.
View 3 Replies
View Related
Aug 5, 2014
I have several tables that are linked that I need to be able to add to. This is an example of the structure:
Patient Info
ID
FK_Ward - ID of Ward table
FK_Room - ID of Room table
FK_Cond - ID of Condition table
Ward
ID
WardID
Room
ID
RoomNumber
Condition
ID
Description
Unfortunately, its not the exact one as I can't post that here! What I am trying to do is to add a new patient record using information from the other tables as guides - e.g. the user selects the name of the Ward but the ID in the Ward table is entered, the User selects the number of the room but again the ID in the Room table is entered, and for the Condition same thing. So I would like to have dropdowns (or ComboBoxes) for each of these and based on the user's selections add a new record to PatientInfo using the ID values as links.
View 4 Replies
View Related
Jun 6, 2013
I have a main table with subject id and other fields. I also have 16 other tables which have questionnaire information at 17 different timepoints. In those tables, the subject id is the only connected field between the main table and 17 different years. When I add a new record (by subject id) on the main table, I want it to add that same subject id to the 17 other tables because that subject id will eventually get all 17 years worth of data. But even using subforms, it will not add a new subject to the other tables unless I add some sort of information such as (date received) into the subform.
View 6 Replies
View Related
Aug 9, 2013
I want to send out my database to a client so they can add records into it via the forms i've created, but I don't want them to be able to change the coding etc. But I also want to be able to update my database and send it back out to them but obviously the records they've entered need to remain. Do i convert it to an accde and then back to an accdb, make my changes then convert again to accde?
View 1 Replies
View Related
May 12, 2014
The database's core is 3 tables: a table for service trips that students can go on, students who may go on those trips, and a junction table linking the two in a many-to-many relationship. Data entry is done literally from the trip table with a +/- node allowing addition of students to the trip detail table.
About 6 months ago, the user's computer was replaced and their office suite was upgraded from 2003 to 2010. Since then, periodically they have called me to say that they are not being allowed to add students to trips. Checking and discovering that I, accessing the same database from another machine, am able to add students to trips;Compacting and Repairing the databse, which did NOT resolve the issue;Opening a brand new database and importing all the objects into it, which DID resolve the issue, temporarily.I just received an email today stating that it has just happened for the 4th time. I can repeat my above-mentioned fix which will probably resolve the issue - again - temporarily.
View 4 Replies
View Related
Jul 5, 2013
I am working on a database where the records are numbered sequentially. On a regularly basis, records will be deleted leaving a gap in the record number sequence. I would like to have my db recognize that a number(s) is number in the sequence and use the missing number (filling in the gaps) when a new record(s) is added until all spaces are filling and then to continue from the largest number sequentially.
View 2 Replies
View Related
Jan 12, 2012
In my database, I need to have a button on a form which when pressed (1) pulls the email address from the displayed record on that form, (2) loads an Outlook instance, (3) in that Outlook instance, load a drafted email for editing and sending.
More detailed: My form, frmReferrals, contains the email address of a contact. I need to have a button, cmdEmail, which loads the email address of the displayed record in an Outlook instance. Ideally, I would like the loaded Outlook instance to pull some other information from the form. For example, I would like it to pull the name of the contact and display it.
Something like this:
"Dear " & [FirstName] & " " & [LastName] & ","
Leads to this:
"Dear John Smith,"
There would be a lot more text in the email with other information to input automatically. I would prefer to use as little coding as possible... but I suspect that all of this will have to be done with coding.
View 2 Replies
View Related
May 20, 2013
I am using a form to add a record to a table and need to be able to specify one of the fields in the table that will be added to. This field is predetermined by another form selection. If there is a way to force a value on a title box with a control source this would also do the trick.
View 4 Replies
View Related
Aug 26, 2013
I have a single column table which is created by set of queries, the data type is of memo, the single column table is a merge of a table with multiple columns by adding a space between the columns.
This table is then exported to the txt file, i want to add header and footer which appears exactly on the position after exporting as of now the header and footer is occuring in between the table data.
View 4 Replies
View Related
Mar 1, 2007
Hi,
I have a table that has records added to it using the following VBa code:
Const MyTable As String = "tblSampleSubmission"
Const MyField As String = "SampleName"
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim intCounter As Double
Dim LastDub As Double
Dim addString As String
Set db = CurrentDb
Set rs = db.OpenRecordset(MyTable)
Randomize
'LastDub = Me.txtStartValue - Was only used to start the random function later in series
addString = ""
For intCounter = Me.TxtStartValue To Me.txtEndValue
rs.AddNew
rs.Fields(MyField) = Me.SamPre & intCounter & Me.SamSuf & addString
rs.Fields("SubmissionNumber") = Me.SubNum
rs.Fields("CustomerID") = Me.CustomerID
rs.Fields("SamplePrep") = Me.SamplePrep
rs.Fields("Fusion") = Me.Fusion
rs.Fields("XRF") = Me.XRF
rs.Fields("LOI") = Me.LOI
rs.Fields("Sizing") = Me.Sizing
rs.Fields("Moisture") = Me.Moisture
rs.Update
addString = ""
If Rnd < 0.02 Then
'LastDub = intCounter
intCounter = intCounter - 1
addString = " DUP"
End If
Next intCounter
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
DoCmd.SetWarnings False
Dim stDocName As String
stDocName = "mroLOIAppend"
DoCmd.RunMacro stDocName
Exit_EnterBlast_Click:
Exit Sub
Err_EnterBlast_Click:
MsgBox Err.Description
Resume Exit_EnterBlast_Click
End Sub
What I would hope to be able to do is add a "standard" randomly to each SubmssionNumber (each SubmissionNumber might be 1-100 records). The record I need to add should be chosen at random from a list of 6 or so options and added at the end or middle or start of the job (SubmissionNumber) is this something that is easy to do or should I just give up and add it manually?
Thanks to everyone who has helped me in the past, it is getting me up to speed quickly. Access seems to be quite popular as I have contacted 3 developers to help with my dB but they are all to busy to help me so I am going it alone.
View 3 Replies
View Related
Jan 26, 2005
My situation:
I have a table with duplicate ids. When I have a forum popup another form, the forms are linked by ids. This works great except for one problem. There are duplicate ids. So if I pop up a form then it will go to the first record that that id exist. This is not good if you are going to add another record. Therefore, I need to create a unique variable for a record. The autonumber would be a great variable but it seems I cannot use it to filter. Unless someone can show me how. Is there another way to create a unique variable automatically for a new record?
View 5 Replies
View Related
Jun 25, 2006
The system is about a shop which gives credit facilities to its customers and so has to keep track of payments effected by them.
I have 3 tables: Customer, Payment, Balance. The main table is Customer, with primary key CustCode which is an autonumber. It keeps personal details of the customers. The Payment table keeps details of payments effected by the customers and the Balance table keeps the overall balance for each customer. The relationships are as follows:
Customer to Payment, 1-to-many
Customer to Balance, 1-to-1
Fields in Payment table: CustCode, PaymentDate, AmtPaid
Fields in Balance table: CustCode, Balance
Problem 1
I have a data entry form for Customer. When I create a new customer record, I want a new record automatically created as well for the customer in the Balance table. How can I do that?
Problem 2
I need to produce a report on customers who have not made any payments during the previous month. I’d like to know how to do that as well.
I hope I’ve made myself clear enough. Thank you for all help.
View 5 Replies
View Related
Nov 6, 2013
I have limited experience in Access, but I have managed to create a user form, where items are selected from comboboxes (Test results; when, who, outcome, etc)
At the end I have built in a command button that should add a record to an existing table, but so far no luck. I have used the following VB code for this:
Private Sub Save_test_results_KeyPress(KeyAscii As Integer)
Dim dbsICT_Test_Management As DAO.Database
Dim rstActual_test_results As DAO.Recordset
Set dbsICT_Test_Management = CurrentDb
Set rstActual_test_results = dbsICT_Test_Management.OpenRecordset("Actual_test_ results")
rstActual_test_results.AddNew
rstActual_test_results.Update
End Sub
View 6 Replies
View Related
May 22, 2013
Whenever I add a new record to a table with a form I created, it records the "ID autonumber" that it's associated with instead of the text. For instance, if I selected "Kevin" from a combobox list and had the form record it, it will show up as "1" in the table under the field name "Names".
View 3 Replies
View Related
Oct 20, 2006
Hi, I have 7 tables in my database and 1 form corresponding to all the fields in these tables (linked by a query by recordsource). My problem is that the form will only show a record if ALL 7 tables have manually had the primary key entered (not good when i have information that needs to be added at different times). How can I make it such that if I create a new record on the form that all primary key fields will be updated, and this record will be present every time i open my the form??
Cheers
Tania :o
View 2 Replies
View Related
May 29, 2014
I have a table with 2 fields in it - Type and Pallet_Case - using a form the user enters the name of the Type and then from a combo box selects either Pallet or Case. There is a button on the form that is to save the new record to the table. (code below) The strangeness that is happening is that when the new record is added to the table, whatever is the first existing record alphabetically in the table is changed to the same Pallet_Case selection that was made for the new record.
I have a list box that displays on the form that is updated after a new record is added to show what records exist in the table (this is done by a query of the table and sorts on the type), so I can see this happening without having to open the table. It doesn't matter what sort order I put the list box in nor the table it still changes the first record alphabetically. And it is only change the Pallet-Case field. I even changed the first record to something else and it still did this.
Dim dbs As DAO.Database, strSql As String
Set dbs = CurrentDb
strSql = "Insert into [PP Type TBL] ([Prepack Type],[Pallet Case]) Values ('" & Me.Type & "','" & Me.Pallet_Case & "' )"
dbs.Execute strSql, dbFailOnError
View 5 Replies
View Related
May 13, 2015
I am currently working on an Access Database that houses our security clearance information. Most of the system is up and running but the most recent form has got me spinning my wheels. I have a Word User Form that users will download and complete, once completed the macros will automatically send us the document to be added to our database. Most of this is working the problem is that this portion of the database has multiple related tables and at any given time a user may require multiple records in the related tables. I have created the code to copy most of the information but am getting stuck adding a new record on the sub-form when multiple items are required. Here is a breakdown of the scenario
Word Doc Table 1 = Basic Organization Info
Word Doc Table 2+ = Sites to Visit (There could be more than 1 table added here)
Word Doc Table 3+ = People to go on site (this might not be the third table based on user interaction for sites)
So far I can get Table 1 and Table 2 data but if there are more than 1 site I cant seem to get the system to create a new record on the related table it is creating a new record on the main form. Here are the lines I used to try to create the related record..
Me.RFV___Agencies1.SetFocus
DoCmd.GoToRecord , , acNewRec
When I put just the above code on a button it seems to have worked as the sub-form showed an additional record was created but when using this on my macro the sub-form is not taking the focus for some reason.
View 1 Replies
View Related
May 12, 2015
I have a table A in which I write down orders for cars. A record is an order. A single order may contain multiple cars in varying quantities.Each car has its components. Some cars may have some of their components common. There is a table B which indicates each car and its components required with their quantities required to build the car. There is a record for each different car.
Now suppose there is a new car we are going to produce so we need a new record in table B for the car and all its components. Also we need a new field in table A because people can now order the new car(in some quantity).
With form for table B we can introduce a new record. But how can we add a field in table A automatically after a record is added in table B?
View 9 Replies
View Related
May 18, 2015
I have an Access table with records that have a two letter, two number alphanumeric identifier (AA01, AA02 etc)
I am trying to create a form whereby, when the user types in the first two letters, the next sequential number from the table is generated.
The letters can be totally random and selected by the user, but the numbers do need to be sequential.
View 1 Replies
View Related
Nov 18, 2014
I have a form where I can add a new resident. It runs off a query that shows ID as null and has a button to add the data and refresh the form and query. I used to drop in OLE files but have since changed it to a linked image file. What I want to do is pull the info from the data that I input as a new resident.
Basically it means that any staff member can take a photo of the resident and put it in a folder and the database will point to that file.
The location is..."C:UsersRP"&[First Name]&" "&[Last Name]&".jpeg" First Name and Last Name are in the table already. I have tried using an append and an update query to no avail.
View 2 Replies
View Related
Jul 2, 2015
I am looking to add a field to my table with a timestamp for each new entry.
I am working with a split database. All of the records are inputted by forms (in the back end by other users). I want to be able to see the exact time that a record was added, but without having to add this field to the actual form. I just want to be able to have a field in the table that shows me when the user submitted an entry. Is there a way to add an automatic timestamp field to the table?
View 1 Replies
View Related
Nov 26, 2013
I have a form to add a record to a table. How can I give the user a way to close this form without saving the just created record.
I tried
If me.dirty then
DoCmd.RunCommand acCmdDeleteRecord
endif
This works, but gives a messagebox in return to confirm the command, and I don't want that. And I try to avoid sendkeys. I also don't want to change the options of access.
View 2 Replies
View Related
Oct 24, 2014
I have a invoice system I have created in Access and it did used to work perfectly and then maybe an update Who knows stopped the system working.
I have an customer order screen that has customer details and then a subform within the same form this takes a total of items & costs for this order and then it entered it into the customers table from the order_Details table using me.Order_total = Order_Total.
I know this is bad design but I store it because once the order is places I need the total to be static because the invoice has been sent and so if someone changes the order then the total owed doesn't change.
I then have a reconcile form which is on a datasheet form straight from the tab;e so it is editable which has a checkbox that then once ticked copies the total from the Order_Total in the table to the reconciled field in the same table and then I use a report to show who owes me still.
So I have made a Select query from the Orders table & Order_Details table and used a Group by Order number (Which is the link between the 2 tables) this shows correctly but now not editable because of the rules So I am trying to add an editable checkbox on the same form.
I tried to use a dlookup makes all of the boxes either ticked or not. I've been looking at Recordsets but I'm unsure if this is what I need or not really
So really I just need to see if I should be putting the Total from the Subform into the mainform and then entering it into the table (Like previously) using a calculated unbound field and then using the Afterupdate event to insert the data into the table. but for some reason it just wont work.
I can get the OnClick to work but then as soon as i go to the next record for some reason it then resorts to 0.00 but then the table shows correctly which ever record the form is working on.
Or should I be using the new query based idea to create the reconcile form and if this is the best way I just don't now where to start on how to get a multiple table query that I can then add a reconciled checkbox which then copies the Order_Total from the table to the Paymet_Recieved field.
View 13 Replies
View Related
Sep 22, 2013
I have split the data base
Added a new table to the back end .But do not know how to update it to the front end
View 4 Replies
View Related
Nov 16, 2014
I have the following script which updates fields in a table.What I am after is a msgbox script to list the ID field value once it is updated.
Code:
Set rec = dbs.OpenRecordset("Select * from Stk_Merge_Delete_Register")
rec.AddNew
rec("StkItemID") = [Forms]![MergeItem]![txtStkFrom]
rec("RackID") = [Forms]![MergeItem]![txtRackFrom]
[code]....
View 3 Replies
View Related