Autofill Datatable Columns With Increasing Numbers
Nov 27, 2006
How to autofill datatable columns with increasing numbers - like the way in Excel? :confused:
Given a datatable with 2 columns : ID & Data.
(a) How to fill the column "Data" with consecutive numbers - 1000, 1001, 1002 ...?
(b) How to fill a specified range of continuous records - eg. records ID100, ID101, ID102 ... ID300 - with (a)?
Many many thanks for any help and discussion!
View Replies
ADVERTISEMENT
Dec 29, 2005
Hi!!
I have a quick question. I have a field that has information that looks like the below. I need it to be in 2 separate columns, but there is no space between the numbers and text otherwise I would know how to do this in excel. Anyone know how to do this is excel or access?
11000031377A & A AMERICAN DETECTIVE BUREAU
It should be separated as....
11000031377 A & A AMERICAN DETECTIVE BUREAU
Any and all help would be appreciated!!! Thanks!
View 2 Replies
View Related
Sep 23, 2005
Alrght I'm new to access databases so I don't want to make the mistake of assuming I know more than I do, so please help me out if you can. Thanks.
I would like to insert a DataTable that is created from reading an ASPX page's TextBoxes into an Access table or two. So here is my code for the insert.
Code: C#
PHP Code:#region Insert
public bool Insert(ref DataTable InsertData)
{
OleDbConnection myConnection = new OleDbConnection();
OleDbCommand myCommand = new OleDbCommand();
OleDbDataAdapter myAdapter = new OleDbDataAdapter();
OleDbParameter param;
DataTable dt = new DataTable();
StringBuilder SQL = new StringBuilder();
try
{
// Build SQL Statement
SQL.Append("INSERT INTO Driver (");
SQL.Append(" Driver.ID,");
SQL.Append(" Driver.ReservationID,");
SQL.Append(" Driver.PrimaryContact,");
SQL.Append(" Driver.FirstName,");
SQL.Append(" Driver.LastName,");
SQL.Append(" Driver.Address1,");
SQL.Append(" Driver.Address2,");
SQL.Append(" Driver.City,");
SQL.Append(" Driver.State,");
SQL.Append(" Driver.Postal_Code,");
SQL.Append(" Driver.Ownership,");
SQL.Append(" Driver.HomePhone,");
SQL.Append(" Driver.CellPhone,");
SQL.Append(" Driver.AutoInsurance,");
SQL.Append(" Driver.Agent,");
SQL.Append(" Driver.Policy,");
SQL.Append(" Driver.Phone,");
SQL.Append(" Driver.Birthday,");
SQL.Append(" Driver.DriverLicNum,");
SQL.Append(" Driver.DriverLicState,");
SQL.Append(" Driver.DriverLicExpDt,");
SQL.Append(" Driver.DrivingRecord,");
SQL.Append(" Driver.DrivingRecordDetails,");
SQL.Append(" Driver.DriverNumber,");
SQL.Append(" Driver.IsDriver,");
SQL.Append(" Driver.InsertDt,");
SQL.Append(" Driver.ReservationID)");
// Insert Values
SQL.Append(" VALUES(");
SQL.Append(" @ReservationID,");
SQL.Append(" @PrimaryContact,");
SQL.Append(" @FirstName,");
SQL.Append(" @LastName,");
SQL.Append(" @Address1,");
SQL.Append(" @Address2,");
SQL.Append(" @City,");
SQL.Append(" @State,");
SQL.Append(" @Postal_Code,");
SQL.Append(" @Ownership,");
SQL.Append(" @HomePhone,");
SQL.Append(" @CellPhone,");
SQL.Append(" @AutoInsurance,");
SQL.Append(" @Agent,");
SQL.Append(" @Policy,");
SQL.Append(" @Phone,");
SQL.Append(" @Birthday,");
SQL.Append(" @DriverLicNum,");
SQL.Append(" @DriverLicState,");
SQL.Append(" @DriverLicExpDt,");
SQL.Append(" @DrivingRecord,");
SQL.Append(" @DrivingRecordDetails,");
SQL.Append(" @DriverNumber,");
SQL.Append(" @IsDriver,");
SQL.Append(" @InsertDt,");
SQL.Append(" @ReservationID)");
SQL.Append(" )");
// Define Connection
myConnection.ConnectionString = _ConnectionString;
// Build Command
myCommand.Connection = myConnection;
myCommand.CommandType = CommandType.Text;
myCommand.CommandText = SQL.ToString();
// Execute
myConnection.Open();
myAdapter.SelectCommand = myCommand;
myCommand.ExecuteNonQuery();
}
catch( Exception myException )
{
// Raise Error
throw new System.Exception("Exception occurred in: " + MODULE_NAME + ".GetListByRVType(). Exception Error: " + myException.Message, myException);
}
finally
{
// Clean up
myConnection.Close();
myCommand.Dispose();
myAdapter.Dispose();
}
}
#endregion
View 1 Replies
View Related
Aug 22, 2013
I have a report that displays 3 different columns of numbers.. and when I try to do a total for any one of the columns the sum option is greyed out and I cannot total any of the columns at the bottom of the report. Everything I have read says I should be able to do that.
View 5 Replies
View Related
Feb 4, 2015
I have various columns of data, a mixture of text and numbers, which all have data in them, and a few columns that have numbers or text. When I copy'n'paste-append into the Access table, the text in the sparsely populated columns doesn't copy across but the numbers do.
It works if I import the spreadsheet from scratch (don't want to do that however, that data comes from somewhere else and would require modification to suit), or if I sort the data so that the text is at the top of the column, it works. Don't really want to do that either as there are 5 columns that this applies to and performing a 5 level sort shouldn't be necessary IMO. It seems that the paste is analysing the data and deeming that it should paste as a number even though the column contains text. There are only 120 rows of data, not a lot! I've tried redefining the field as Long Text (currently Short Text) but it doesn't make any difference.
View 2 Replies
View Related
Nov 27, 2012
i have been trying to combine data from 2 different sources, to make unique rows: here it is my situation Data in DGV already in dgv, Unbound:
column1 | Qty
"Sugar", 100
"Salt", 100
"Color", 200
"Malto", 150
Data in datatable:
column1 | Qty
"Sugar", 80
"Salt", 60
"Apio", 25
"Lemon", 60
"Color", 60
So i want a control that matches the column1 in datatable against DGV.Column1, and if value matches only add second column value and if not, then make a new row in DGV.
Final decided outcome:
column1 | Qty|Qty2
"Sugar"| 100 | 80
"Salt" | 100 | 60
"Color"| 200 | 60
"Malto"| 150
"Apio" | | 25
View 1 Replies
View Related
Jul 10, 2006
Hello
I have two tables tblCList and tblCode. The primary key of tblClist is an autogenerated number which is the foreign key to the tblCode.
The tblCList has another column names sClist.
whenever I import values from Excel into the tblCode, I need Access to look up the text values from the sClist in the tblClist and insert the appropriate number corresponding to the entry in tblCode.
Please Help
Thanks
View 2 Replies
View Related
Oct 25, 2007
I have a program that I’m attempting to get counts using ADO. The code is below.
Global Const ConnString = "ODBC;UID=user;PWD=passwd;DSN=ORA"
Dim OraD As ADODB.Connection
Dim rsPreSample As ADODB.Recordset
Set OraD = CreateObject("ADODB.Connection")
OraD.CommandTimeout = 0
OraD.Open ConnString
sql = "select count (recip) from recipfile where recip >= ‘111111111’
Set rsPreSample = New ADODB.Recordset
rsPreSample.Open sql, ConnString
ADO has a default timeout of 30 seconds. I want to set it to 180 seconds, but the timeout keeps getting ignored. Can someone help me get a new timeout to execute?
View 2 Replies
View Related
Aug 22, 2006
Hi,
I have created two databases to try and speed up some data manipulation. One database is acting a a 'sniffer' and runs make table, delete, append and normal view queries. the append and make table queries will either write to the other database (the receiving database) or to itself. I have therefore managed to reduce a run time for these queries from 10 minutes for all queries, to less than 1 minute (as previously all in one database using forms).
The problem is these databses contain only about 10 tables to which I am adding data (non of them contain more than 5000 records at the moment) and I also have approx 50 ODBC linked tables (about 30 MB worth so I can retrieve data i want to write to the tables).
The databse has run through my 10 queries about 50 times (each time pasting new info to my receiving tables - still no more than 5000 records) however both database have increaed from a few MB to over 900MB - Is there any way I can stop this from happening as this seems to be a rediculous increase in size - i am also having huge problems compacting the databases.
thanks
View 1 Replies
View Related
Jun 4, 2007
I'm making an access database and I'm using the auto number data type for the ID field. But is there a way of increasing the value of the auto number without adding and deleing records over and over again? Basically the database is replacing an excel document that is currently being used. There are already over 5000 entries in the excel document and the access database needs to carry on from the last record in the excel form. Importing the excel data isn't possible, so how would I increase the auto number value?
Thanks
View 2 Replies
View Related
Jul 20, 2014
Using Access 2007..I have a table where the RecordID is an autonumber, and PK.To set this table up I have a load routine, (becuase I have done this multiple times for testing and further deveopment and I compact and repair the DB prior to loading) - the 690 records are correct numerically and autonumbered.This table has transactional data where existing records are updated and new records are appended.
I found the autonumber was not incrementally increasing - so no reseed the auto number (using ALTER TABLE 3IWSPLans ALTER COLUMN RecordID COUNTER (1000,1)) prior to starting the transactions.
New transactions will append correctly, up untill I amend a existing record (using a delete and append query via a staging table) - then the autonumber tries to reuse a number already in the table and because its not unique it errors.why the auto-number is not incrementally increasing correctly
View 7 Replies
View Related
Jul 24, 2013
Access stops me from increasing the size of a key field
Table tTrades
. Key field: idTrade: auto-number
. Field: Code: Text 10 characters
Table tData
. Key field: Code: Text 10 characters
I get an error message when I try to change either of these Code fields from size 10 to 16 characters
Error message - you cannot change the data type of field size. It is part of one or more relationships. Te change the data type of this field, first delete its relationships in the relationships window.
I deleted all relationships in the relationships window. But I still get the same error message.
If I click on relationship window > "All realtionships", Access reproduces all my relationships in the relationship window. Somehow it knows them. I deleted them all again and saved. But I still get the same error message.
I have a form ftTrades which generates automatically when I click on table tTrade and create a form.
I deleted this form ftTrades. But I still get the same error message.
How I can increase the size of this field.
View 3 Replies
View Related
May 1, 2013
I have an Access Database of around 8MB. However, after a day's use, this file size increases to around 110MB. If I run a Compact and Repair, the file returns to it's usual size. The first time I noticed this, the file had reached a size of 2GB which is a bit alarming. The file does get used but only appending around 50 records a day and making some amendments. What could be causing this increase?
View 3 Replies
View Related
Dec 5, 2007
Hi all
I have a database I built for my employers that is accessed by up to as many as 50 users at one time. It is a relational database. I did a compact and repair this morning which changed the BE from 215MB to 45MB. I went to lunch and came back and the database is now 58MB. Does anyone have any ideas as to why it has increased by 13MB within an hour? There is no way this is caused by geniune data records.
Thanks
Gareth :eek:
View 8 Replies
View Related
Jun 11, 2015
I have written a check writer program for the company I work at. I have a table for Venders, and a separate table Invoices set with a 1-many relationship. When checks are printed it consolidates all the unpaid invoices for each vender to print a single check and mark it as paid with the date.
The checks already have a check number printed on them so what I need is an option that will allow me to enter the first check number when the print starts and Access will put that number in a field on the invoices page for each invoice associated with the first vender printed, then would increase the number by one and put that number in the invoices associated with the next vender printed.
View 5 Replies
View Related
Aug 12, 2014
I'm having multiple problems with my database like things such as -
i'm currently working on the Query 2 - On the Phone database (ignore Query 1) and i want to search for multiple plot numbers preferably in one parameter prompt with a comma to seperate numbers. (this could be a multitude of numbers so i would like to be able to input as many as needed). Also when i do search on this query since the Criteria is a 'Between' Value i would expect everything between the 2 numbers input to show up - but a lot of numbers out of the range show up too - why is this? (The Numbers are like "69 to 136" and they will show up - but 1-69 and 136-170 would too
I would also like to implement the search results from Query 2 into the Form i currently have made but it just opens up a access table when the search is made?
i cannot link my database as it is too big for the server - But here are the Criteria for Query 2:
Plot No - (criteria = Between [Enter First Plot No:] And [Enter Last Plot No:])
Site - (criteria = Like "*" & [Enter Site:] & "*")
Product - (criteria = Like "*" & [Enter Product:] & "*"
The Query is the one im most concerned about , i can live without a form.
View 14 Replies
View Related
Sep 18, 2006
Hi,
I'm trying to get the maximum number in a table field to increase it by one depending on the member that is selected in a drop down in a field.
I have three tables: members, programs and times. Each member can have N programs and each program can be broadcast N times.
Each member has a three digit code, like XXX. Each program has the three digit code of the member + three numbers that are supposed to auto increment. That is, the first program of member X with the member code XXX is called XXX001.
What I'm trying to do is that when a new program is filled in and I select the member, then the program code should update automatically, adding one to the latest program by that member.
That is, if the last program by member X that was inserted in the database is XXX010, then if a new program is inserted it should automatically be XXX011, even though programs by other members have been added in between.
This is the code I use now, for the AfterUpdate when selecting the member in a dropdown in the form. But although I've played around a bit, I just get error messages...
Private Sub medlemsruta_AfterUpdate()
Dim medlemskod
medlemskod = Me![medlemsruta].Column(2)
Dim strMax As String
strMax = DMax("programs_kod", "table_programs", "Left$(programs_kod, 3) = medlemskod")
Me!program_kod = Left$(strMax, 3) & Format$(Val(Right$(strMax, 3)) + 1, "000")
End Sub
Medlemsruta is a dropdown where one selects the member from the members table, where the three digit code is in the third column (Column(2)).
I'm trying to use DMax to get the maximum number for the particular member and after that adding 1 to that for the new program code.
Grateful for any advice! Thanks!
View 3 Replies
View Related
Jan 10, 2007
Ok so in excel I have some numbers that are stored as text. The reason being that they are zip codes and some begin with 0 and excel doesn't want numbers to start with 0....so when I import these into an access field that has an input mask for zip codes...will it convert these correctly since the field is a text with input mask?
View 1 Replies
View Related
Aug 24, 2014
I have 2 fields that I would like to automate if possible
One field is called "p/o number" and another field called "line no"
These fields are part of an ordering database
Let say I have 200 items to purchase form 10 suppliers
And form example 20 items from each supplier
What I do at present is put the order number on each line item and the line number
example
p/o number line no
1 1
1 2
1 3
2 1
2 2
2 3
2 4
What I want to do is just put the first po number in the required line . Put the first line number in i.e. "1" and the macro will complete all the p/o numbers and line numbers for me as per the ones marked in red.
Example
1 1
2 2
3 3
2 1
2 2
2 3
View 5 Replies
View Related
Aug 8, 2013
I was able to use the UNION ALL qry. But, when I have another file (like original2) that does NOT have all the columns listed in the UNION ALL qry, I get a Parameter value box asking for the missing columns when I run the qry.
Example:
original1IDDateGroupChristianJohnnySteve 18/5/2013A1528/5/2013B338/5/2013C2348/5/2013D2358/5/2013E5
original 2IDDateGroupChristianJohnny18/6/2013A212528/6/2013B2338/6/2013C2248/6/2013D22
The UNION ALL qry includes all the possible resources ( includes all the possible column fields Christan, Johnny, and Steve).
When I run the UNION ALL qry with the original2 file, An "Enter Parameter Value" box is displayed with the mssing column name "Steve".
Is there a way to Map the original2 table into a working table with all the columns, or use VBA code to construct the UNION ALL qry to only include the existing columns? My data has variable columns and I'm trying to avoid the parameter popups.
View 2 Replies
View Related
May 14, 2014
I have a MS ACCESS 2010 database with a data table which i am trying to create a query from. I have 6 columns of data( one with an ID Field and 5 Name Fields). Below i have made examples of how it first appears as a simple query and the second will show you what i would like it to look like.
What the simple query looks like: [URL] ...
Second what I want the query to look like: [URL] ....
View 2 Replies
View Related
Oct 30, 2007
Currently I'm building tables and forms. My first table (called Clients) lists the details of fictional clients. My second table is for invoices.
In my invoices table, I wish to link the column for client reference (note: stored in the Clients table) to the column that precedes it. This column will list the clients’ names and is selected from a drop down list that is linked to the Clients table.
What I want to do (if its possible) is to have the respective client ref. automatically show up in the next cell once I've selected the client to whom the invoice relates?
Am I making sense? Is that possible? If so, how do I do it?
Secondly, how do I do a sum of selected columns for my “totals” column? Basically, I want to add the figures found in several cells that precede it?
View 4 Replies
View Related
Mar 22, 2007
I'm affraid my confusing topic title is an indicator of how confused I am by this. I can't even understand the variables well enough to fully utilize Access Help or the Search function here...
What I have is a database hat has column headers that look something like this:
Customer_Name, Order_Date, Qty_Ord, Unit_Price, Total_Price
What I'm trying to get is a query output that will have
Customer_Name, Total Orders (in Dollars) for January, Total Orders (in Dollars) for February, Total Orders (in Dollars) for March, etc.
I've been able to set it up to SUM for one month, but not multiples.
I know I'm totally lame (for proof read any of my previous posts) but you guys totally bailed me out the other time I asked a lame question.
Thanks in advance!
View 3 Replies
View Related
Mar 29, 2005
I have a form based on a table with several fields. The table contains names of employees and their departments, etc.
When I fill in the form with the employees name, how can I have it autofill the dept?
I am not a programmer so if specific code is required, I would need to know exactly what it is.
Your assistance is appreciated.
View 1 Replies
View Related
Dec 10, 2005
Two questions,
1. After my relationship table is built, is it possible to have some tables automatics fill in according to what another field in the table is inputed? EX: I have a Ordertable(orderID,itemID,Itemdesc), and a Inventory table(ItemID,Itemdesc), When you select an Itemid to put in the order form, the order Description from Inventory would appear in the Itemdesc of the order form.
Is this possible? If so how?
2. In tables, is it possible to make a cell = to something? So like if I wanted to add a subtotal and a final total after tax, I could use = * .08 or something?
View 1 Replies
View Related
Apr 22, 2006
Can I fill all cells in a column that dont contain any data with the same value?
I have a table with about 1000 records, I have a column called "brand", half of the records contain some data but the other half dont and I really the ones that dont to contain the text "none".
Any Ideas?
Thomas
View 2 Replies
View Related