Adding A Field To A Table In Access

Aug 4, 2006

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


End Function

View Replies


ADVERTISEMENT

Adding A New Field To A Table In Access 2000

Jul 31, 2006

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

View 3 Replies View Related

Adding To Access From The Field

Nov 26, 2007

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.

View 3 Replies View Related

Adding A Value To New Field In Access

Jun 5, 2012

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.

View 2 Replies View Related

How Would I Go About Adding A Field Or A Table?

Oct 2, 2005

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.

View 1 Replies View Related

How To Update Access After Adding A New Field?

Apr 27, 2007

Hi

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?

View 1 Replies View Related

Modules & VBA :: Adding A Field To Access DB

Aug 6, 2013

I use the following 3 calls to add 3 fields to an Access db,

Code:

Call subCreateField("tblRootCanalTreatment", "lngMethodID", "dbLong", strPath, 606)
Call subCreateField("tblRootCanalTreatment", "txtReferencePoint", "dbText", strPath, 620)
Call subCreateField("tblRootCanalTreatment", "txtSpaceForPole", "dbText", strPath, 644)

The sub is indicated below,

Code:

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.

View 14 Replies View Related

Adding A Field To A Linked Table

Mar 27, 2008

Hi folks,

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

HUGE THANKS in advance!

View 7 Replies View Related

Adding Field To Form And Table - Please Help

Nov 18, 2006

hi,
I added a field to a table in the backend
I also addded the same field to show up in the form

Now the problem I am facing is that in a new record I can type my values for all fields but an error(2465) is thrown when i try to save it

I suspect that when this field is added in the form it is not getting committed/saved into the table

how do i go about doing this?
thanks

View 1 Replies View Related

Tables :: Adding Value To A Table Field

Mar 20, 2014

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?

View 1 Replies View Related

Adding Same Data To Different Field Within Another Table

Apr 14, 2013

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.

View 3 Replies View Related

Adding A Record And Specified Field In Table?

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

Access 2003 Database - Adding A Field?

May 31, 2006

Hi

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

Thanks!

Stu

View 2 Replies View Related

Adding A Record To A Table From A Field List?

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

Adding Security To A Field In Linked Table

Jun 4, 2007

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!

View 2 Replies View Related

Adding Field To A Make Table Query

Dec 27, 2005

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

View 1 Replies View Related

Queries :: Adding New Field To Resulting Table

Jul 2, 2013

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.

View 6 Replies View Related

General :: Adding Access Field To Mail Merge?

Jun 19, 2013

Is it possible to add an access field to a mail merge without having to recreate/redo the mail merge?

View 2 Replies View Related

Modules & VBA :: Adding Y Or N To A Field If It Is Not Null In Access 2010

Dec 18, 2014

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.

View 2 Replies View Related

Adding A Second Auto Number Field To Current Table

Jun 22, 2007

Is this possible, and how can I do it?

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.

View 2 Replies View Related

Adding Feild Values And Storing In Another Field In Same Table

Mar 19, 2005

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!!

View 2 Replies View Related

Adding Fields In A Table To Create New Field In A Query

Mar 14, 2008

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.

How do I do that?

View 14 Replies View Related

Queries :: Connecting Data - Adding Field From Another Table

Jun 15, 2015

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.

View 5 Replies View Related

Tables :: Adding A New Field When A New Record Is Added In Another Table

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

Tables :: Adding Field To Table And Updating Data?

Dec 1, 2013

I have a table in my DB called, devices. This contains all the information about various devices we have deployed in the field.

These devices are also contained in 2 other separate MySQL DB's.

What I need to do is add 2 additional field to my access table for the DeviceRecno and DeviceID of the same device from the MySQL DB's.

Adding the field is easy, but I cant think of a way to enter the recno and ID from the other DB's without typing them in manually for each one.

The common between them all is the serial number of the device, and I can get a list of serial numbers, recno's and ID in an excel sheet.

like a vlookup in excel to easily populate all the existing records with the recno and id's from the other db's?

When I created the access system there was no intention to link it to the other DB's for any reason, but that has now changed due to a lot of reasons.

View 4 Replies View Related

Adding Blank Field Through Make Table Query?

Aug 28, 2013

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.

View 5 Replies View Related







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