Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

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 Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old July 27th, 2003, 07:15 PM
Nevyn Nevyn is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Melbourne
Posts: 2 Nevyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Updating records using the results of another Recordset

Morning All,

I hope someone can help me here...
I am trying to fill in the blanks within the records of a table using information already in that table.
i.e: I have five records with the same 'premise code' but only on has 'Tier' information - I want to be able to put this information in all 5.

I thought I had it with this code but when I run it Access just shuts down on me...program not responding.

Could someone have a look and maybe VET my code and tell what what simple thing I am missing.

---------------------------------------
Private Sub Tier_Click()

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim strSQL2 As String

strSQL = "SELECT DISTINCT [Premise Code], Tier "
strSQL = strSQL & "FROM [Combined List] "
strSQL = strSQL & "WHERE Tier Is Not Null;"

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

Do Until rs.EOF
strSQL2 = "UPDATE [Combined List] SET Tier='"
strSQL2 = strSQL2 & rs!Tier & "' WHERE [Premise Code]='"
strSQL2 = strSQL2 & rs![Premise Code] & "';"
db.Execute strSQL2
rs.MoveNext
Loop

End Sub
--------------------------------------

Any help would be much appreciated

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Updating records using the results of another Recordset


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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway