Need To Insert Blank Rows If Record < 1000
Mar 24, 2005
Hello all!
I have a database that needs to post records that are joined from three different sources into a table. The query is done, and I get about 1,489 records out in 4 different states.
What I need to do is make a table with these records. Furthermore, it must be separated by state, whereas if there are less than 1000 records for each state, it must insert blank lines until it reaches then next thousandth (sp?) row (i.e. 1001, 2001, etc.), and then start posting the next state.
For example, AZ has 420 records. There has to be 580 blank lines before the query can start posting the next state, CA. At row 1001, CA starts posting, but there are only 200 records for CA so there must be another 800 blank lines before moving on to CO at row 2001, etc. etc.
Anyone have any ideas on this? Thanks!
View Replies
ADVERTISEMENT
Oct 2, 2013
How to insert x number of empty rows at once in a query? All fields allow null.
Say, if I wanted to "resize" the table to 3000 records...
View 6 Replies
View Related
May 21, 2013
I've received a database that is a digitized population register from the 19th century. All adults have been entered into the database, but all children are missing.
Every person has a unique number that corresponds with the original source (this variable is called 'no', this is not the autonumber primary key thing). Instead of searching in the original source which numbers are still missing, I would like to add the missing numbers (with no additional information, because I still need to type that in).
For example, the table now looks like this:
no - name_last - name_first - occupation etc
1 Smith Henry baker
2 Smith Mary
5 Williams John butcher
6 and so on
So 3 and 4 are missing.
How can I add these missing numbers automatically?
View 3 Replies
View Related
Aug 28, 2014
I am at work, and I have acquired a database that prints labels. They now want the database to be coded so that after certain labels are printed the database will print a blank label. I have the code figured out as a Do While statement in order to print the blank label. The problem I am having is that I am trying to use the Insert Into command to insert the filepath into the table that adds the blank label.
|DoCmd.RunSQL "INSERT INTO Rod_tmakLabels ( Print, [Order] ) SELECT Yes AS Expr1, 'Rods Labels' AS Expr2"|
If I run the above command, it just adds the text "Rods Labels" at the end of the table. Is there anyway with the INSERT INTO command that I can insert the new label between the 2nd and 3rd row and add another row? Or is the command designed only to add a new row to the end? I haven't had any luck searching for this yet.
View 1 Replies
View Related
Feb 14, 2005
Hi everyone,
I am using the following code as an import button on a form, everything works and it imports the data but for some reason it imports several blank rows as well all the other data?
Private Sub bImport_Click()
On Error GoTo Err_bImport_Click
Me.tbHidden.SetFocus
If IsNull(tbFile) Or tbFile = "" Then
MsgBox "Please browse and select the most recent file.", vbCritical, "Invalid File"
Else
DoCmd.SetWarnings False
DoCmd.OpenQuery "Delete Daily Download"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Daily Download", tbFile, True
DoCmd.OpenQuery "Update"
DoCmd.OpenQuery "Archive"
DoCmd.SetWarnings True
MsgBox "imported, updated and archived", vbOKOnly, "Imported Data"
End If
Exit_bImport_Click:
Exit Sub
Err_bImport_Click:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_bImport_Click
End Sub
I have checked the source spreadsheet and there is definatly no information being displayed.
Anyone know what could be causing this?
Thanks a lot
Tim
View 2 Replies
View Related
May 28, 2006
Hi Folks.
As a newbie in Access, but not in Excel, I tried to 'get external data' from an Excel spreadsheet into an existing Access table.
However, it brought in blank rows because those rows had a formula in them but nothing else.
Any way to avoid the blanks being imported??
Many thanks
morrisg
View 4 Replies
View Related
Feb 20, 2008
Can someone tell me how to insert a blank row after every 4th row of data?
Here is the query:
SELECT B.NAME, B.WORKER, C.[SUB SYS] INTO D
FROM B, C;
data comes back like this
NAMEWORKERSUB SYS
GORDON N PAUL0000ACRT
GORDON N PAUL0000AENF
GORDON N PAUL0000AFIN
GORDON N PAUL0000ARAP
GORDON N PAUL000ATCRT
GORDON N PAUL000ATENF
GORDON N PAUL000ATFIN
GORDON N PAUL000ATRAP
I want it like this
NAMEWORKERSUB SYS
GORDON N PAUL0000ACRT
GORDON N PAUL0000AENF
GORDON N PAUL0000AFIN
GORDON N PAUL0000ARAP
GORDON N PAUL000ATCRT
GORDON N PAUL000ATENF
GORDON N PAUL000ATFIN
GORDON N PAUL000ATRAP
View 5 Replies
View Related
Nov 13, 2006
I'm trying to insert multiple rows into a table at once, but I'm having problems.
I've tried a syntax like this:
INSERT INTO [TABLE] ( [FIELD1], [FIELD2], [FIELD3] ) VALUES
(( '1', 'A', '1' ),( '2', 'B', '2' ));
..but with no success.
On a site I even found this other way, but with no success either...
INSERT INTO [TABLE]
SELECT '1', 'A', '1'
UNION ALL
SELECT '2', 'B', '2';
Is it possible to insert multiple rows and I'm just missing the syntax, or is it not possible with Access?
View 1 Replies
View Related
Nov 6, 2006
I am trying to insert multiple rows to a table using the query
insert into rvp (rvp, rvp_name, controller_id)
values (1200, 'rvp1', 10), (1201, 'rvp2', 10)
But I am getting an error "Missing semicolon( at the end of SQL statement" and placing a semicolon at the end isn't helping either. I can insert a single row so column type or primary key isn't a problem.
Here's the table structure,
rvp - number (pk)
rvp_name - text
controller_id - number
Can someone please help me out.
View 3 Replies
View Related
Dec 28, 2006
Hello,
I want to copy data from one table to another:
INSERT INTO Table1 (codeid) SELECT codeid FROM Table2 WHERE a=7
it works, but the problem occurs when diplicate entries occur in codeid of Table1 (because is is set to No Duplicates).
As a result no rows are inserted. It's OK, cause that's the way it should be, but I was wondering if there is a way to tell MS Access to skip insertion of values that will cause duplication. So the rows that are ok will be inserted and the ones that cause duplicates will be skipped.
I just don't want to go through the loop and insert row-by-row.
Thank you.
View 2 Replies
View Related
Dec 8, 2006
hi i have a main form called "frmMain" that i use for users to add new studentsNumbers txtStudentsNumbers.bound to tblStudents also this form has a combo box called cmbDepartments coming from tblDepartments.
Then a subform which right now it has a combobox called cmbSubDepartments (coming from tblSubDepartments) , this combobox has a rowsource to update everytime someone selects a dept in the main form so it shows the subdepartments belonging to the departments.
Each department has a a set of Subdepartments, also has two texboxes called txtTuitionA, and txtTuitionB.
so in total i have three tables each with the pk id.
what i need is that when a user enters a student number in the main form, select the department where they want to add the student to, then the subform gets automotically populated with all the subdepartments so then the user is forced to enter TuitionA and tuition B to each subdept for that particular students
i tried this...
(in the main form)
Private Sub cmbDepartment_AfterUpdate()
Dim intQty As Integer
Dim i As Integer
If MsgBox("Are you sure you want to add a new tuition plans for this student?", vbYesNo) = vbYes Then
Me.txtStudentID = DMax("StudentID", "tblStudents") + 1 'get New student number 'Add the new row into Main Table tblStudents
intQty= me.cmbSubDepartments.itemdata -1
For i = 1 To intQty - 1
strSQL = "INSERT INTO tblStudent (StudentID, SubDepartmentID) SELECT StudentID, SubDepartmentID FROM tblSubDepartments WHERE SubDepartmentID = " & Forms!frmStudentsTuitions_subform!cmbSubDepartment s & ";"
CurrentDb.Execute strSQL
Next i
Me.frmStudentsTuitions_subform.Requery
Me.frmStudentsTuitions_subform.SetFocus
Else
DoCmd.CancelEvent 'if user choose no in question then undo
DoCmd.Close acForm, Me.Name 'close current form
End If
End Sub
but my subform does not get updated... :-( .
View 4 Replies
View Related
Oct 6, 2012
I use this vba code to insert data in access database 2007. It's working for one row, but when I try to use for more rows and columns give me "Type mismatch".
Code:
Sub Simple_SQL_Insert_Data()
Dim cn As ADODB.Connection '* Connection String
Dim oCm As ADODB.Command '* Command Object
Dim oWS As Worksheet
[code]...
View 5 Replies
View Related
Mar 4, 2014
I have a PivotTable that I am trying to put together that will give me the following:
Types of Payments - Left
Accounts Where Payments came from - Top
Amount of Payments - Data
I want it to look like a spreadsheet where it will show me all the Types of Payments even though I don't have any data in there. Almost like an Excel Spreadsheet but I want it in Access. I was able to get the Columns to show up even though I had some blanks but now I need the Rows to show up.
View 11 Replies
View Related
Apr 26, 2006
Hi,
I'm new to Access and I've run into a little problem. I've created a table with a primary key (autonumber) which will contain 1520 records. At present I only have data for the last 8 records. Ideally I would like to create 1512 blank records, with only the autonumber entered e.g. 0001, 0002, 0003 etc.
Unfortunately I cant add the data that I have got to 0001 - 0008 as it relates specifically to the primary ID.
Thanks.
View 10 Replies
View Related
Dec 12, 2013
I decided to link Excel files and all is running fine except when I run a query on the file I get about 1,041 blank rows before my data is displayed in the query's datasheet view or any report based upon this query... the data seems good but why the leading blank rows? The data in the linked Excel sheet does not look like this and another Excel file's query looks fine and they seem set up identically!
View 2 Replies
View Related
Aug 22, 2013
I have a main report / subreport relation, just want to have a fixed length of each printout. e.g the total number of lines of the subreport should be 8 lines. However, lots of subreports contain records less than 8. I would like to know how to insert of blank line in the subreport depending on the records with content at each print, in order to make the total number of lines in each subreport is 8 each print!!
View 1 Replies
View Related
Nov 14, 2005
Hi,
I Had A Program Using Access '97 Which Is Currently Running On 10/100 Lan With No Problem, When They Changed The Lan To 100/1000 Even If We Copy The Database To Another Node And Tried to Open It Gives Error In Index Or Unrecognisable Database Please Help Other Programs Like Excel, Word Are Working Properly. Currently switched back to 10/100 LAN and the same database opens without any problem. Is it because of the transfer speed?
View 1 Replies
View Related
Aug 5, 2005
I've been scratching my head all night, can someone tell me why the attached query doesn't work?
Thanks,
Sup
View 3 Replies
View Related
Sep 8, 2013
I have a form set to the table Client Information with a subform set to the table Event Information. Client Information has a one to many relationship to Event Information.
There is a button that deletes the current record in Client Information--also deleting the related records in Event Information--then closes the form. The code works fine but a blank record in Event Information is apparently being created before the form closes.
Here's the VBA that I'm using:
Private Sub CmdDelReturn_Click()
Dim CmdDelReturnMsg As String
CmdDelReturnMsg = MsgBox("Delete event & client then return to front?", vbYesNo + vbDefaultButton1, "Delete and Return?")
[Code] ....
It's not a big deal because the button won't be used often and I can manually go into the table to delete the blank record. But if there's a simple solution to prevent this that would be nice.
View 3 Replies
View Related
Oct 8, 2013
I am using an Access 2010 DB to keep track of a schedule. Essentially, at least one person needs to be signed up to work for every hour of every day in a week.
Tables:
Days with 7 records
Hours with 24 records
Workers with as many people that sign up to work the different hours
Schedule signifying the worker, day, and hour which are signed up.
As of now i have a query that relates these results and gives me a line detailing the worker/time information for the slots that are signed up for.What I'm TRYING to do is to create a query that gives me BLANK worker info when there is no one signed up for a particular hour.Currently my Schedule table has the following:
WorkerID | DayID | HourID
----------+---------+--------
1 | 5 | 12
4 | 5 | 13
16 | 5 | 15
What I'm looking to do is have this table matched up with another table (or query) that provides every combination of day/hour. When an day/hour combination is skipped, the query will be able to "fill in the blank" with a row. Like this:
WorkerID | DayID | HourID
----------+---------+--------
1 | 5 | 12
4 | 5 | 13
| | 14
16 | 5 | 15
View 2 Replies
View Related
Oct 10, 2007
I have a table of products and a table of ordersEach product requires multiple processes to completeCan I make a query that will lookup the products in the orders table and show a list of all the processes that need to be done to complete all the products on order?The bit I dont get is how can a query return multiple rows for each product?
View 3 Replies
View Related
Dec 4, 2006
I've created a form for updating / inputting data to my table. Currently it is defaulting to show the existing data from record 1 of my table. But as the most frequent requirement of the form will be to add a new record to the table, I would like it to default to show a new blank record. Is there a way of doing this? Perhaps some code that I could incorporate against the "on activate" for the form.
Thanks.
View 2 Replies
View Related
Jul 19, 2005
Is it possible to add a row between rows on a form. I am creating a contact list containing phone numbers and groups. I dont want to sort the form out in ascending order, just by group order.
For example:
Joe Teacher (primary school) 12345
John Teacher (primary school) 67777
Ann Teacher (secondary school) 35555
Mary Teacher (secondary school) 388338
Sarah Nurse 373773
Tina Nurse 111111
Peter Footballer 199999
Rob Footballer 888888
Any ideas would be great :confused:
View 8 Replies
View Related
Aug 19, 2004
oh, finally I am close to what i need
I have the report in the included db. there are 2 problems though.
1
the subreport DOES sum the total for each outlet if there is one, BUT it includes a row for each outlet, therefore repeating up to 3 times.
ex:
if EN-02 and EN-05 have values 1 and 3 recorded on the same date then the report has the rows:
March 8, 2004 1 0 3
March 8, 2004 1 0 3
when it should only show 1 of the rows
and if there is a value from another date it includes it in this as well.
so how can i have this limited to the sum where the dates are the same.
2
how can I have it display "No flow" if there are no values instead of '0'
thanks for all your help in advance
~
View 5 Replies
View Related
Mar 19, 2015
I have attached a sample spreadsheet. Each store has a planned date which is calculated off the dates in column b and c. The second row is actual date.
As much of the data I have is in MS Access, I tried to use some extracts to appear in this format but no luck.
View 11 Replies
View Related
Aug 1, 2006
I have a form with a drop down of employee names and a tabbed subform.
I have the form and subform set up to open on a new record and, when the employee name is selected to fill the subform with that employee's data.
It is a split db with the be on the network server and everyone has their own copy of the fe. When I open the front end the combo box is blank but the first page on the tabbed subform shows data. If I close it and reopen it, sometimes its blank and other times it still shows data.
What else do I need to do to ensure that it is a blank record?
Also, I am using the MouseHook.dll and included it in my .exe (zip) file to all of my users, instructing it to download to the same location as the .mdb file (C:/Training Database). Will this work or does the MouseHook.dll need to be somewhere else?
Thanks,
Toni
View 3 Replies
View Related