IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Access
Search Access Group:

Advanced
-Collapse +Expand Access To/From
To/FromCODEGuides
-Collapse +Expand Access Store
PRESTWOODSTORE

Prestwood eMagazine

December Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyMicrosoft Access BoardAccess VBA Programming Topic   Print This     

next record

next record in Access VBA Programming topic (part of our Microsoft Access group).

Quick Search: next record  
princealbert
 (Inactive)
TN
I am kind of new to access programming but have basic knowledge of databases and visual basic. I have been given the task of updating certain fields given that another field within that record meets certain criteria. I have managed to get one record to change when I press a button but I can not figure out how to advance to the next record so I can nest the code in a loop. Here is what I have so far:

Private Sub ceilingbutton_Click()
Dim myunit As String
Dim CeilingHeight As String

Text84.SetFocus
If Text84.Text = "" Then
MsgBox "Please ceiling height"
Exit Sub
End If

CeilingHeight = Text84.Text
Form_ProjectBOM.Number.SetFocus

If Ctl100.Value = -1 Then
If Form_ProjectBOM.Number >= 100 And Form_ProjectBOM.Number < 200 Then
myunit = Form_ProjectBOM.Number.Text
Form_ProjectBOM.Ceiling_Height.SetFocus
Form_ProjectBOM.Ceiling_Height.Text = CeilingHeight
MsgBox "Ceiling Height for unit " & myunit & " changed to " & Form_ProjectBOM.Ceiling_Height.Text


End If
End If
Form_ProjectBOM.Requery

end sub


In VB I would code something like

do until EOF
... ...
currentdb.recordset.movenext
loop


Basically I need to change to field "ceiling height" for each record that has a number between 100 and 200 if the 100 series checkbox is checked and so on.....100,200,300 etc.

any help would be appreciated. thanks
 Posted 20 years ago (Thread Starter)
Comment Quote
About princealbert -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #4160, 3 replies
Thread Started 10/26/2001 7:44:00 AM
View Counter=2095
Location=TN  
Joined=20 years ago   MB Posts=2  
ScottCybak
 (Inactive)
Windsor, Ontario, Canada
This could easily be performed via a saved update query. You could run it from vba via the DoCmd.RunSQL function.

If you need help with the query, let us know.
 Posted 20 years ago
Comment Quote
About ScottCybak -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #4161 (Level 1.1)  Reply to 4160
Thread Started 10/26/2001 8:32:00 AM
View Counter=2
Location=Windsor, Ontario, Canada  
Joined=20 years ago   MB Posts=64  
Most Recent Post
ScottCybak
 (Inactive)
Windsor, Ontario, Canada
Albert (i'm assuming)

Rather then doing this in vb code, construct an update query. This will use NO vba code whatsover, will out-perform it's counterpart and will be way easier to maintain.

Take a look in Access help for Update Queries

HTH
 Posted 20 years ago
Comment Quote
About ScottCybak -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #4164 (Level 1.2)  Reply to 4160
Reply Posted 10/26/2001 9:05:00 AM
Location=Windsor, Ontario, Canada  
Joined=20 years ago   MB Posts=64  
princealbert
 (Inactive)
TN
if you could help me out that would be great.


I tried something simular i.e.

DoCmd.RunCommand (acCmdRecordsGoToNext)

dont know much about sequel but maybe you could help. will I need to requery in order to see the pointer on the next line??

Thanks in advance....
 Posted 20 years ago (Thread Starter)
Comment Quote
About princealbert -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #4163 (Level 1.3)  Reply to 4160
Reply Posted 10/26/2001 8:57:00 AM
Location=TN  
Joined=20 years ago   MB Posts=2  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P195A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #4160 Counter
2095
Since 4/2/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2021 Prestwood IT Solutions.   [Security & Privacy]