Writing To Another Table
Nov 17, 2006
Hi,
I am fairly new to msaccess programming and am trying to build a stock control system for my business.
I am happy with everything I have done so far but there is one thing I cannot figure out.
I have set up so that the user can click a button and remove the relevant number from the stock level. The buttons are for removing 1, 5, 10 or 20 (there are reasons for these numbers). However I would also like the button to take information from the form (which is referenced to a query) and write that information, along with an autogenerated id number and the current date/time to another table. This is for our record keeping, so that we can record what is selling well etc and when the last one was sold.
How do I do this?
I have gone through the help files and my books, but I think the problem is I don't know where to start looking.
I also want to add a button that will add items to an order table. Again by taking the information from the form and writing it to another table. With this one a message will appear asking for the quantity to be entered. It will also check the order table to see if the item is already there and advise if it is.
Any help gratefully received.
Steve:confused:
View Replies
ADVERTISEMENT
May 17, 2005
I hope this makes sense?
I have a main form with a button that opens a new form. On the new form I have 5 fields. 1 of those fields is the Employee ID which I have the form getting from the main form (IE the Control Source is =Forms!Search_Employee!Employee_ID )and the other fields are bound to my table for the new form. I am unable to get the Employee ID to show in my table, it is not updating or writing the value to that field. Not sure if there is code or how I should or can get this field to write to my table. Any Ideas or be very appreciated. Thanks anyways guys I igured this one out. I was able to set the dafault value to point ot my main form so that my Control Source could point to my table and it worked.
View 1 Replies
View Related
Oct 18, 2005
Hi,
I have a check box that gets ticked when 'work complete', it adds the parts/service totals and fills in the 'parts total', 'vat' and 'total' fields.
This works fine but I need it to write the values to the table as well rather than just displaying the values in the fields so reports can be produced etc.
Anyone know the easiest way to do this?
Thanks
Housey
View 5 Replies
View Related
Dec 8, 2006
Hi all,
wonder if anyone can assist me with this the SQL Server
security/write (?) issue. The SQL Server Admin has created a table for our Dept. to use and via SQL Server I can get access to it using the username and password she supplied to me. I can also link to this table in Access 2002 via ODBC which is the way I am using to write to SQL server tables. I have developed an Access application to allow one of our staff to be able to write data to the SQL Server table at a click of a button, however when I open the table the 'add new record' button is greyed out, I can not add any data to the table.
I explained this problem to the Admin as well as the way in which we access the table and she is certain that the problem lies in Access but i'm unsure how that can be the case.
Has anyone experienced this problem before ? Is there a fix and if so how is that implemented ?
Should I also post this in the SQL server forum ?
Thanks in advance,
Mitch....
View 3 Replies
View Related
Apr 26, 2007
Hi all,
I need to figure out how to have two calculated fields written to the database table instead of just being displayed in the form.
The user selects a number from 1 to 5 in the first field, and a number from 1 to 7 in the second field. The first calculating field multiplies these two numbers and displays the result. The second calculating field determines where the resulting number fits in three ranges of numbers and displays the result as Low, Medium, Or High.
My problem is the calculated results are be displayed in the form but not being written to the table. I cannot create a report to display all the High results, etc.
How do I update the calculation field formula to write the results into the table so I can create queries/reports on the calculated data?
Thanks,
bugleboy62
View 3 Replies
View Related
Jan 16, 2013
I'm using Access 2010 and am trying to pass a variable in a form field and store it in a table i.e. I have a customer database with various fields: Customer_ID, Customer_Name, Customer_Address etc. After selecting a particular record i.e. Customer_ID = 20 l need to store the record number '20' in a temporary table. I presume that l could then use Dlookup to read the info back at a later stage.
View 7 Replies
View Related
Mar 23, 2006
Can anyone tell me what's wrong with the below statement ? I'm trying to pull the contents from a text box in a form. The text box is supposed write the contents to a field (memo data type) in a table. Thanks ! ! !
strComments = Forms![Payroll History]![Comments].Column(0)
View 14 Replies
View Related
May 22, 2006
Hi Guys, I don't know Access very well but I know enough to generate a 2 dimensional database. The problem I have is that I have been asked to look at a travel agents database to create some additional letters. The problem is that they use a form which has an underlying data table called customers. When they create a record in the form all fields in the customers table are filled in except those on the form which derive their data by calculating two or more fields i.e Date Due is [Date of Travel]-70 (days), Balance Owing is [Cost]-[Deposit]. None of these derived fields fill in their corresponding fields in the customers data sheet.
I would welcome any ideas please. Thanks in anticipation
PompeyFC
View 3 Replies
View Related
Jun 6, 2013
I am trying to write some fields to an access table definition. It is working for the most part except that I want to write some of the fields as dbText and others as dbDate. For some reason it is writing all of them as dbDate and I don't know why.
Code:
additionalColumns = Array("a","b","c","d","e","f")
'add additonal columns to report
For i = LBound(additionalColumns) To UBound(additionalColumns)
MsgBox additionalColumns(i)
If additionalColumns(i).Value = "a" OR "b" Then
Set columnNames = xlsht.Cells(1, additionalColumns(i))
Set FieldName = tb1.CreateField(additionalColumns(i), dbDate, 10)
tb1.Fields.Append FieldName
Else
Set columnNames = xlsht.Cells(1, additionalColumns(i))
Set FieldName = tb1.CreateField(additionalColumns(i), dbText, 150)
tb1.Fields.Append FieldName
End If
Next i
View 3 Replies
View Related
Sep 21, 2011
I need to create a table with names of controls on my forms.
I'll use that table to apply user rules.
Any solution to write the table automatically using VBA code ?
I know how to populate a combobox...
DoCmd.OpenForm YourFormName, acNormal, , , , acHidden
Dim c As Control
For Each c In YourFormName.Controls
[Control-Name].RowSource = [Control-Name].RowSource & c.Name & ";"
Next c
..., but not how to write a table.
View 1 Replies
View Related
Nov 3, 2014
I concatenated 2 fields CR_Numbers: = CR_Number & [Sub Number] to display 12.01: from 12 and 1. I am now wanting to lookup the CR_Numbers to edit or add information into other fields.
I want to use a pop up form to edit/add data without having the form add an entire row to the table. How do I reference the Table ID so that it will go to the equivalent row to add the data in?
Main Table = Change Request
Email Table = AORB_Email
Fields in Form!AORB_EMail: Change Request (CR_Numbers), Priority (Pri_Name), Hours (Hour)
I plan on using the Priority and Hours in the email to set some dates and expiration times as well as in the subject of the email. I have figured out the email setup, and if I manually fill in the Priority and Hours fields everything works as it should.
View 14 Replies
View Related
Jan 5, 2005
This is the first time that I have done any major work with forms. After I thought I had finished a problem came up. There are several forms that are use to input information into a table. When the form is opened it grabs an automated number for tracking. The problem is, that if the form is opened and then closed it creates a line of data with all null values.
What I would like to do is have the form open, the user fills out the information, and upon pressing the "save" button, the data will save to the table. I think I need to have each text box write to a variable and then save on the click event. Or I could be completely wrong and need to do something else.
i'm guessing this is something I would learn in Forms 101 if i had ever taken that type of course
Thanks
View 7 Replies
View Related
Dec 1, 2014
I am using Access 2010. How do I prevent the object typed into the textbox on a queryform being written to the table. The result from the name typed into the textbox on my query form correctly produces the result from the query, and my macros then produce the correct report, which I can either print or close due to the controls in the heading of the report. However, when I view the table, the name typed (only) has been inserted into the correct field as a new record in the table. Is there a macro I can add (I assume to an event in the query form) to prevent this happening?
View 8 Replies
View Related
May 19, 2015
Basically, I originally wanted to create a form which I can input data into Access with by using a button (I was unable to get Access to append the information from the forms to the table, so it didn't work out!). I did not want the fields on the form to be linked to a table, as then a record (and most importantly an auto-number) is created as soon as somebody starts typing. Should somebody stop typing halfway through and quit the form an autonumber will have been generated, which makes the number of "users" seem higher than it actually is. I got around this by changing the field from autonumber to number and then creating a query that selects the maximum value of ID in the table, then adds 1 to it (which is essentially the lowest unique number. I tend to call this newID).
The problem I now have is setting this to be written to the table alongside the data from the form (the rest of the fields on the form are now connected to the table, as I am no longer using an autonumber). I have tried the following: Setting the form to run the expression "[ID] = [qryMaximumUserID]![NewID] " on load. This returns the error "The object doesn't contain the Automation object 'qryMaximumUserID.' Setting the control source of the text box to be dLookup. This fills the textbox with the correct value, but then it doesn't write it to the table! Setting the default value of the field to be 0, then running an update query to update any ID of 0 (criteria "0" to the value of newID "update to: [qryMaximumUserID].[NewID]. "). However this doesn't work as whenever the query is run it asks for a parameter to be entered, rather than just taking the value from the other query. Writing a macro that is run on load to SetValue of item:[ID] to expression: [Forms]![qryMaximumUserID]![NewID]. However this returns an error "Microsoft Access cannot find the referenced form 'qryMaximumUserID' you entered in the expression.
View 4 Replies
View Related
Jul 2, 2013
I am periodically importing Excel files into access.Making the data usable requires removing spaces, parsing certain fields, adding datasource field, etc. Currently, I am importing the un-formatted data into a staging table, cleaning it up with a query and then copying the updated staging table to the final table.
View 2 Replies
View Related
May 31, 2006
Hi
I have three fields on the form. First one is Combo box - "Contact person", Second - "Code" is Text field, Third - "Department" is the text field. Corresponding to this I have a table "Department "with fields Contact person, Code, Department.
I want that when I select the Name from the combo box, corresponding records like Code and Department should appear in the respective text box.
Help me in writing this code.
Thanks in Advance Very much
Deepak
View 2 Replies
View Related
Jul 25, 2007
Hi gang, I'm an Access rookie with a problem. I have a table with three columns and I need to create a result field which will "count" the number of occurences of a value in the "CustNum" field. (There are other columns in the table as well so I can't use a "count" function) Please see my simulated results in the "Count" column. I'd like to have a query create this expression. Any help? Thanks! Sorry for the formatting, not sure how to replicate a table in my post.
CustNum FirstLast Count
9891247372KURTFENCHEL 1
9891247372KURTFENCHEL 2
9891247412GRIEGMOORE 1
9891247412GRIEGMOORE 2
9891247412GRIEGMOORE 3
9891247414JohnVerwey 1
161243818DANILOLAMBO 1
9891247198MICHAELSAUNDERS 1
9891247211CATHLEEN DELANOY 1
9891247211CATHLEEN DELANOY 2
9891247211CATHLEEN DELANOY 3
9891247211CATHLEEN DELANOY 4
9891247211CATHLEEN DELANOY 5
View 2 Replies
View Related
Apr 27, 2006
I'm not sure this can be done,but here goes it, I have 5 [plants] A, B, C, D & E. If one plant recieved [A] plant reject [Reject] then I need a response from plants B, C, D & E. If plant [B] receives a reject then I need a response from plant A, C, D and E. How would I show what other plants havent' responded>
How would I create a query for this? any idea's would be greatly appreciated
View 2 Replies
View Related
May 17, 2005
Hello,
I have a procedure which I undertake and wonder whether it can be automated in any way.
I have a field on a form for Purchases (frmPurchases) for a Purchase Order number. To get the order, I click on a command (cmdpo) which opens another form and clicking a command on this form (cmdgetpono) produces a unique Purchase Order number. I then manually copy the number given and paste it into the field on frmPurchases (PONo).
I have not used Macros before but cannot see that there are the options to achieve this. If someone could suggest the ones I should uses fro the list it would be appreciates.
Alternatively, is there another way of looking at this?
Thank you
Lin
View 2 Replies
View Related
Mar 15, 2006
This was to dumb to write in the title. But when I am trying to write a code, the drop down, only stays down for a few seconds. Does that mean I am doing something wrong. I am trying to learn to write, but I am about sharp as marble, when it comes to writing.
Any Ideas
As usual
Many thanks
View 3 Replies
View Related
Sep 6, 2006
Hello all
Further to an earlier post asking how to check if forms were open ...
I have a form EditCompanyForm which pops up to let people edit the details of a company. The form can be opened from one of three forms.
When the EditCompanyForm is closed I want to update the form that opened it.
So I have this rather ungainly bit of code.
__________________________________________________ ___________
Private Sub Form_Unload(Cancel As Integer)
Dim oAccessObject As AccessObject
Dim FormName As String
FormName = "CompaniesForm"
Set oAccessObject = CurrentProject.AllForms(FormName)
If oAccessObject.IsLoaded Then
Form_CompaniesForm.Requery
End If
Dim oAccessObject1 As AccessObject
Dim FormName1 As String
FormName1 = "CompaniesCallForm"
Set oAccessObject1 = CurrentProject.AllForms(FormName1)
If oAccessObject1.IsLoaded Then
Form_CompaniesCallForm.Requery
End If
Dim oAccessObject2 As AccessObject
Dim FormName2 As String
FormName2 = "CallListForm"
Set oAccessObject2 = CurrentProject.AllForms(FormName2)
If oAccessObject2.IsLoaded Then
Form_CallListForm.Requery
End If
End Sub
__________________________________________________ _
Do I need 3 separate AccessObjects?
Should I be using ... Set oAccessOjbect = nothing ... at the end?
Is there a more elegant way of doing this?
Thanks for any insights.
View 4 Replies
View Related
Feb 11, 2005
Hey guys,
So I'm trying to get the hang of having a Microsoft Access db on an ASP page. I'm just testing the water right now to see how to do simple stuff (selects and updates). Tomorrow I'm going to do loops. Exciting.
Anyways, the tester I have right now is doing a basic update, then select and then print the results. I'm getting the following error:
"Item cannot be found in the collection corresponding to the requested name or ordinal."
It didn't give me this error when the field name was only one word. But because this particular field has spaces in it (and I can't do anything about that sadly), it throws this error. I tried offsetting it with the [ ] but that doesn't do it like it does for the SQL command. I searched the web and didn't really find anything of any help.
The line is:
Response.Write "NAME:" & rs("[Full Name (Name Field)]") & "<BR>"
Without the brackets it gives an exception error message.
Any thoughts?
View 3 Replies
View Related
May 31, 2006
Hi
I have three fields on the form. First one is Combo box - "Contact person", Second - "Code" is Text field, Third - "Department" is the text field. Corresponding to this I have a table "Department "with fields Contact person, Code, Department.
I want that when I select the Name from the combo box, corresponding records like Code and Department should appear in the respective text box.
Help me in writing this code.
Thanks in Advance Very much
Deepak
View 1 Replies
View Related
Mar 5, 2008
i have a string in VB (eg. "test")that will cahnge depending on the input, ihow can i search for the string and display the data into a form?
i currently have this
"SELECT [Tasks].Staff_Name, [Tasks].Project_Title, [Tasks].Percentage_Complete, [Tasks].Tracking_Number FROM [Tasks] WHERE [Tasks].Staff_Name like [forms].[Main].[test] ORDER BY [Tasks].Staff_Name;"
but how can i make it so it spits the data into its corresponding feilds onto a form? (just like it would be if i performed a wizard?)
View 1 Replies
View Related
May 31, 2006
Hi
I have three fields on the form. First one is Combo box - "Contact person", Second - "Code" is Text field, Third - "Department" is the text field. Corresponding to this I have a table "Department "with fields Contact person, Code, Department.
I want that when I select the Name from the combo box, corresponding records like Code and Department should appear in the respective text box.
Help me in writing this code.
Thanks in Advance Very much
Deepak
View 1 Replies
View Related
May 17, 2006
OK, I have two tables that have pretty much the same data in them, but, the first table has SOME data that the second table doesn't and I need to get that data into the table that does not have it.
Here's a description of what I want to do:
Table #1 has about 10,000 lines of data with the employee SSN as the ID for the records. In this table are two extra columns of data (HRContact)and(HR ContactCode) that are not always populated in Table #2.
Table #2 has about 300,000 lines of data with the SSN as the ID field. Some of the records that match the SSN's from Table #1 have the data HRContact and HRContactCode, but not all of the records have those fields populated.
So, what I need to happen is for the query to go through Table #1, find the SSN of a record. As it finds each SSN, it goes to Table #2, finds that same record with the same SSN, then looks in the HRContact field to see if there is data there, or if it is Null. If there is data in that field, then it goes on to the next SSN in Table #1 and repeats the preceeding process. If the data in HRContact is Null in Table #2, then it goes back to Table #1 and grabs the HRContact and HRContactCode data for that record and writes it into the HRContact and HRContactCode field for the record in Table #2. the query would repeat this process until it reaches the end of file in Table #1.
I hope this is clear and if you have any questions, please ask me...
Thanks for your help,
Dave
View 1 Replies
View Related