I have created the code below to add a new column to a table each month. This may not be the best database design but it meets our needs for now.
However I am having difficultly with the code below. The CreateField Function is unable to accept the parameter periodDate. Any Suggestions on this would be apprerciated
Function DateField() As Long
Dim colFullName As Object
Dim dbsCurrent As Object
Dim yearInt As Integer
Dim monthInt As Integer
Dim table1 As Object
Set dbsCurrent = CurrentDb
Set table1 = CurrentDb.CreateTableDef("103TblCustomerBalancesCombined")
yearInt = Year(Date)
monthInt = Month(Date) - 1
If monthInt = 0 Then
periodDate = CLng(yearInt - 1 & 12)
Exit Function
End If
If monthInt < 10 Then
periodDate = CLng(yearInt & "0" & monthInt)
Else
periodDate = CLng(yearInt & "" & monthInt)
End If
Set colFullName = table1.CreateField(periodDate, DB_TEXT)
table1.Fields.Append colFullName
I want to add a new field to a table each month end. the name of this field should reflect the previous month. For example when running the update in August 2006 the name of the field should be for July 2006, the format of the field should be as follows: 2006 07. Is there any way to create a function in Access to do this, thanks
Hi again. I finally have time to start working on my access project, and what I want to know is how could a field technician add to access from the field, either with a laptop or possible even a pda. things a tech would need to add are notes, different readings that monitor job progress, equipment placed at the job site, other things like that.
I'm importing a text file into Access. The file is just a string of numbers that I'm breaking apart into three fields. Once those three fields have been broken apart by the import tool I need to add a new field that just contains the year.
For example, I import the 1990 data file that is .txt format and I break apart the three fields while it's imported. Once imported into three fields, I want to add a 4th field that says 1990 for every record. This has to be a pretty simple thing to do, but I can't figure out how to add a single number as a new field to every record in the database.
The attachment is the database Im working on and I have a problem. I need to add a supplier Product number in there some where so I could keep the numbe as reference and so it may be easier to enter items recieved. in the form section, I will have Invoice with a sub form Invoice details. I need to put suppliers Item number somehow so it would search and if the item is on the product list it would fill out the rest of the values.
should I make a separate table for suppliers product number or should I just include that into the invoice detail? I dont want to put it in the product table since I get same Items from different suppliers.
1. I need to know how to update the field list of the query after adding a new field into the table and the query? 2. I need to know how to update the records table after adding calculated filed?
Private Sub subCreateField(strTable As String, strField As String, strFieldType As String, strPath As String, lngVersion As Long)
Dim rstSerial As ADODB.Recordset Set rstSerial = New ADODB.Recordset rstSerial.Open "tblSerial", CurrentProject.connection, adOpenKeyset, adLockPessimistic rstSerial.MoveFirst If rstSerial!lngVersion < lngVersion Then
[code]....
Only the first field ("lngMethodID") gets created. The other two fields ("txtReferencePoint") and ("txtSpaceForPole") do not get created. If I exit the db before each sub call then all fields get added. Do I need to add some "refresh field" action or other action.
I am really struggling w/ the following & would greatly appreciate advice!
I want to add several Fields to a Linked Table in Access. The Access wouldn't let me do it because it is a Linked Table. What should I do?
There is also a nicely designed Form that goes w/ that Linked Table. So I figured that once I add the Fields in the Table then I can add them to the Form too. - But can't even add the fields yet....
I am building a DB for my college, it is needed to replace a spreadsheet they have in place. The spreadsheet is used to monitor and track Students grades.
Each unit a student passes gives that student a certain number of points, the number of points depends on the grade (e.g. a student will get more points for a B than they would for a C). The point of the DB is to input all the students grades so that student can see how many points they have.
I was wondering if there is a way to add a value to a field, so if I put in a field that a student got a B grade the database would know how much a B grade is worth points wise. Each field should be added together to generate an overall score. Is this possible?
I have tblCategory and tblExercise. The data in tblExercise can sometimes match with more than one record in tbCategory. When inputting data into tblExercise how can I choose to have that stored under more than one field in tblCategory?
Example:
tblCategory: Arms tblExercise: TRX Biceps Curls so TRX Biceps Curls can also be under tblCategory: TRX
Right now I have to input TRX Biceps Curls under Categories Arms and TRX. Very time consuming.
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.
I'm adding to a database that someone else set up. I went to the Design View page and clicked on one of the buttons at the bottom to add a text box etc etc. It all looks fine, but the field doesn't seem to be active - if I add some text into it for one page of the databse, the same text appears on every page of the databse. I notice that my "new field" is not listed in the fields list. How do I add it? I keep looking through "The Missing Manual" but without spending 3 days reading the whole thing (which I don't have time for) and learning much much more than I need to know just to get to the part that I need to know, it isn't helping me much.
Please can anyone enlighten me? My email is stu_paranormal@yahoo.co.uk
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
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.
Can someone tell me how to go about adding security to a field in a linked table so that only certain people can access and modify the information? I am using Access 2002. I also wonder if someone can tell me how to modify a field in a linked table? I have tried altering and saving the changes, but it won't save them because it's a linked table. Thank you in advance to anybody who can help me out here!
I have a make table query created from a linked to a table. i want to add field to the make table query that are not fields on the table. How do i insert a created field? Hopefully this is a basic question.....
I am looking to create a query that adds a new field to the resulting table. The field should be 'Yes/No' and for every entry the default should be 'Yes'. The query looks something like this:
Code:
Select .*, [here the new field] From MyTable1 Union Select .*, [here the new field] Form MyTable2
The Union statement isn't really relevant, just for completion's sake.
how to make this two fields in my form to say Y or N if the field is Not Null. Like if the field is not null = Y Else = N for the two fields. I have a picture to show what i'm talking about.
Adding a second auto number field to current table and auto numbering current entries?
I need to combine some records from the same order number that currently have detailed names. I'm trying to simplify them, but I can't because it creates duplicate records.
I have been struggling with this and would appreciate any help. It sounds so simple!!! I have 4 fields (Unit Price 1, Unit Price 2, Unit Price 3, Unit Price 4) in a Orders table that I want to add together and store in a 5th field (Sub Total) in the same table using a form. I am having problems with the sum and I am unsure how to get it to show in the Sub Total box in the form as well as the table. Thanks for your help!!
I've got a fields called rev code that contain the following values:
field name: 110 131 250 255 258
field value: 7.49 6 11.25 12.11 78
I'm writing a query that pulls from the first two digits of the rev code and need to round off to the nearest dollar so in my query I'll have a column 11 with a value of 7, a column 13 with a value of 6, then I need to take columns 250 255 and 255 add the values together and round off so I get a column 25 with a value of 101.
I have a query all set up and now I have to add one field from another table in it. I am looking for a date which has the criteria Now() - Last Movement Date. Last Movement Date is the column I am taking from the other table which I just added which is the ZLX02 table. When I run the query, everything but the Last Movement Date shows up. What can I do to get the Last Movement Date to show? Check out the attached pics.
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?
I'd like to know how to add a blank filed (memo), called "comments" that is not pulled in from any existing table, in an existing maketable query which is getting it's fields from different linked tables , so that the destination table that comes out of this query, has all those data along with an extra column for me to add comments.