I have a database with fields "ID" and "DocName" that is sorted by ID.
A sample of the record data is:
1, OneDoc
2, null
3, null
4, null
5, AnotherDoc
6, null
7, null
8, null
9, YetAnotherDoc
10, null.
I would like to autofill the records with the following results:
1, OneDoc
2, OneDoc
3, OneDoc
4, OneDoc
5, AnotherDoc
6, AnotherDoc
7, AnotherDoc
8, AnotherDoc
9, YetAnotherDoc
10, YetAnotherDoc.
I can copy and paste, and do an update query, but hope to find a
procedure that will be faster.
Thanks for the help! 1 9658
AFAIK, an update query will be the fastest to execute.
Otherwise, you could write DAO code in VBA to read the table (use a Query
that sorts on ID, just to make sure), and save the DocName if it isn't
empty/null, set it from the saved value if it is empty/null.
Dim db as Database
Dim rs as Recordset
Dim strSQL as String
Set db = CurrentDB()
strSQL = "SELECT ID,DocName FROM yourtable ORDER BY ID"
Set rs = db.OpenRecordset (strSQL)
rs.MoveFirst
Do Until rs.EOF
If Len(rs.DocName)<>0 Then
strDocName = rs.DocName
Else
rs.Edit
rs.DocName = strDocName
rs.Update
End If
rs.MoveNext
Loop
rs.Close
Substitute your table's name for "yourtablename" in the statement setting
strSQL.
"Jake Brooks" <ja**@digidatacorp.com> wrote in message
news:85**************************@posting.google.c om... I have a database with fields "ID" and "DocName" that is sorted by ID. A sample of the record data is: 1, OneDoc 2, null 3, null 4, null 5, AnotherDoc 6, null 7, null 8, null 9, YetAnotherDoc 10, null.
I would like to autofill the records with the following results:
1, OneDoc 2, OneDoc 3, OneDoc 4, OneDoc 5, AnotherDoc 6, AnotherDoc 7, AnotherDoc 8, AnotherDoc 9, YetAnotherDoc 10, YetAnotherDoc.
I can copy and paste, and do an update query, but hope to find a procedure that will be faster.
Thanks for the help! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: simon |
last post by:
From my previous post...
If I have a structure,
struct sFileData
{
char*sSomeString1;
char*sSomeString2;
int iSomeNum1;
int iSomeNum2;
|
by: JC Mugs |
last post by:
I have a form that when you tab from field to field that the entry point is
blank, but if you point and click in the field it brings up a 0 and data
entry is started to the left of the zero.
...
|
by: tshad |
last post by:
MSN has a toolbar that has a Form Fill function that will try to fill form
fields on forms when they come up.
The problem is that it causes problems with some forms and functions.
I found this...
|
by: alienstudios |
last post by:
We have a table that has a multi-line per person record Here are the fields
ID
Gene1
Gene2
Gene3
Each person usually has two records (IE two Rows have ID 1)
However in one row Gene 1 is...
|
by: visionstate |
last post by:
Hi there,
I have a form which has 2 text boxes, a combo box and a sub form in it
(which reads from a query. The query reads from the table).
On load, I would like the fields in the text boxes and...
|
by: sparks |
last post by:
I am trying to fix a database that someone did about 4 yrs ago in
access97.
The main table just contains demographics and is on the main form of
the database.
It has a subform on a tab that...
|
by: KelHemp |
last post by:
Greetings,
I've been using this site for lots of access help in the past, and it's very helpful! I have a new complexity for you all.
Reworking a form to record 70-80 years of oil production on...
|
by: M Skabialka |
last post by:
I am creating my first Visual Studio project, an inventory database. I have
created a form and used written directions to add data from a table to the
form using table adapters, data sets, etc.
...
|
by: DaveLock |
last post by:
Hi,
I have 3 tables of data created from different sources, each with the same 2 fields & I wanted to fill the 2nd field of another table with the data on condition.
The condition is because...
|
by: Cosmic programmer |
last post by:
How do I make a input text box appear like a fill in the blank line. i.e.
1. is it possible to hide some of its borders and display only the bottom
border?
2.to place is just above a sereies of...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |