Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 3rd, 2004, 06:50 AM
mystixa mystixa is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 3 mystixa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
fill down table in access

Ok Ive looked and looked and read a multitude of threads to no avail. Please help me on this one.

I have imported a table into Access, I had no control over the original format of the table so Im stuck with the data as it is in that original doc.

So as it sits now in access..
index mnem client name
--------------------------------
1 310055 blah foo
2 blah2 john
3 blah4 joe
4 310099 grr12 bob
5 blah2 john

etc. * about 50,000 literally in size.

Looking at the empty cells in the 'number' column I need each of those to be filled. to end up with:
index mnem upin name
-------------------------------
1 310055 blah foo
2 310055 blah2 john
3 310055 blah4 joe
4 310099 grr12 bob
5 310099 blah2 john

I did this once in VB/excel but it was prohibitively slow. Im positive there is a better SQL/Access solution but just cant quite get it. My best effort to date is:
DLookUp("[mnem]","upin","[index]=" & [index]-1)
criteria mnem Is Null
In an update query updating mnem.

Downside all I get is say there is a block of 4 empty spaces in a row before the next mnem comes along, only 1 cell will be filled per run of the query.

i.e.
index mnem upin name
-------------------------------
1 310055 blah foo
2 310055 blah2 john
3 blah4 joe
4 310099 grr12 bob
5 310099 blah2 john


I figure #3 is somehow looking up at #2 before its updated and taking that empty value. ..just cant figure a way around it though.

I know this has been done before but no matter how much googling and forum diving Ive done I havent found something to specifically address this.

Thanks in advance for your help

Reply With Quote
  #2  
Old November 3rd, 2004, 11:33 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 14
The should get you started

Table1
Code:
index	mNem	ClientName
1	310055	blah foo
2		blah2 john
3		blah4 joe
4	310099	grr12 bob
5		blah2 john



SQL
Code:
SELECT T1.index, T1.mNem, T1.ClientName,
(IIf ( isnull([T1]![mNem])  , (Select top 1 mNem from Table1 Where t1.index>Table1.index and Table1.mNem is not null order By table1.index Desc) , [T1]![mNem] ) ) as NEW_mNem
FROM Table1 AS T1;




Results
Code:
index	mNem	ClientName	NEW_mNem
1	310055	blah foo	310055
2		blah2 john	310055
3		blah4 joe	310055
4	310099	grr12 bob	310099
5		blah2 john	310099




S-

Reply With Quote
  #3  
Old November 4th, 2004, 11:13 AM
mystixa mystixa is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 3 mystixa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
your solution

Wow.. that is great! Now I have been trying to convert that into a Update query but keep getting the dreaded...
'Operation must use an updateable query' error.

..*sigh* so at any rate.. I have been studying that as well and have found nothing useful. bunch of stuff about permissions and then a few things about the jet engine not being able to find a unique record to update, but that doesnt seem right in this case. Is it illegal to use a subquery in an update?

..on a second note.
Just for my own edification. (Since I posted it in an odd format above.) If my old non-working SQL was

UPDATE upins SET upins.mnemonic = DLookUp("[mnemonic]","upins","[index]=" & [index]-1)
WHERE (((upins.mnemonic)="" Or (upins.mnemonic)=" " Or (upins.mnemonic) Is Null));

Why would that only update the first empty record per set. Say theres 5 empties in a row only the first would be updated. Just doesnt make sense to me. If you feel like guiding the blind a bit here I would thank you heartily on that as well.

Just trying to gain some understanding instead of taking your code and running you know.

Thanks endlessly..

Quote:
Originally Posted by sbaxter
The should get you started

Table1
Code:
index	mNem	ClientName
1	310055	blah foo
2		blah2 john
3		blah4 joe
4	310099	grr12 bob
5		blah2 john



SQL
Code:
SELECT T1.index, T1.mNem, T1.ClientName,
(IIf ( isnull([T1]![mNem])  , (Select top 1 mNem from Table1 Where t1.index>Table1.index and Table1.mNem is not null order By table1.index Desc) , [T1]![mNem] ) ) as NEW_mNem
FROM Table1 AS T1;




Results
Code:
index	mNem	ClientName	NEW_mNem
1	310055	blah foo	310055
2		blah2 john	310055
3		blah4 joe	310055
4	310099	grr12 bob	310099
5		blah2 john	310099




S-

Reply With Quote
  #4  
Old November 4th, 2004, 03:51 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 14
Here is what you do

you change the query I gave you into a "Make Table Query"


Code:
SELECT T1.index, T1.mNem, T1.ClientName, (IIf(IsNull([T1]![mNem]),(Select top 1 mNem from Table1 Where t1.index>Table1.index and Table1.mNem is not null order By table1.index Desc),[T1]![mNem])) AS NEW_mNem INTO tblQuery6
FROM Table1 AS T1;



The you write an update statement based on the new Temp table

Code:
UPDATE Table1, tblQuery6 SET Table1.mNem = [tblQuery6]![NEW_mNem]
WHERE (((Table1.index)=[tblQuery6]![index]));



This works

You have to base the update off the table and not a query, at least this is the way that works for me when I do this. Don't have to do this very often.

S-

Reply With Quote
  #5  
Old November 16th, 2004, 08:44 PM
mystixa mystixa is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 3 mystixa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
looking for more solutions...

Not that I didnt like the last one.. but the make table query alone took 27 hours to compete. I think cause Im now looking at a database of almost 100k entries on not so state of the art machines.

I think having a subquery going through the entire databse for each entry is the killer. ..isnt that like 100k*100k queries?

So I cant quite get it straight in my head but isnt there something that can be done along these lines...

index mNem ClientName
1 310055 blah foo
2 blah2 john
3 blah4 joe
4 310099 grr12 bob
5 blah2 john
index mNem ClientName
1 310055 blah foo
2 310099 grr12 bob


Taking data from the second table to fill in the first. So you get to a NULL in table 1 and lookup the corresponding data in table 2 that has mnem less or to what you've passed?

Still working.

Reply With Quote
  #6  
Old November 17th, 2004, 12:28 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 14
If you have that many records in a table, it may be time to move to a new DB (SQl Server, MySQL)

The other option is to accept that this is a one time process and you can live with the system taking time for it.


Quote:
Code:
 ..isnt that like 100k*100k queries?


NO it could be view as 100K+100K, but it is really only query


If you thought of setting bu a new table like:

index mNem ClientName
1 310055 blah foo
4 310099 grr12 bob

As long as you keep the orginal Index, you might be able to get this to work, you will have to try.

S-

Reply With Quote
  #7  
Old November 5th, 2009, 08:18 AM
pogopatterson pogopatterson is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 1 pogopatterson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 52 sec
Reputation Power: 0
Simulating Fill Downs

Quote:
Originally Posted by sbaxter
The should get you started

Table1
Code:
index	mNem	ClientName
1	310055	blah foo
2		blah2 john
3		blah4 joe
4	310099	grr12 bob
5		blah2 john



SQL
Code:
SELECT T1.index, T1.mNem, T1.ClientName,
(IIf ( isnull([T1]![mNem])  , (Select top 1 mNem from Table1 Where t1.index>Table1.index and Table1.mNem is not null order By table1.index Desc) , [T1]![mNem] ) ) as NEW_mNem
FROM Table1 AS T1;




Results
Code:
index	mNem	ClientName	NEW_mNem
1	310055	blah foo	310055
2		blah2 john	310055
3		blah4 joe	310055
4	310099	grr12 bob	310099
5		blah2 john	310099




S-


Thanks SBaxter, you've saved me countless tedious hours filling rows in Excel.

Reply With Quote
  #8  
Old November 9th, 2009, 06:51 PM
Sneakz Sneakz is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 90 Sneakz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 28 m 2 sec
Reputation Power: 1
So did you respond to this post 5 years later because your machine finally finished running the query? LOL

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > fill down table in access


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek