Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Access record processing


  • Please log in to reply

#1
johnbfdma

johnbfdma

    Member

  • Member
  • PipPip
  • 19 posts
I want to use VBA to perform a sequence of steps in each record in an Access table. I have browsed through a couple of Access books and VBA for Dummies, but none of them seem to describe how to start at the first record, modify some fields, go to the next record and repeat the modification.

If I could write the program in "Progress" it would say:

/* Proceedure Rollforward */
define variable set-year as integer.
prompt-for set-year.
for each record:
year = set-year.
field-2 = field-1.
field-1 = field.
field = "".
end.

How would that work in an Access VBA module that is called by a menu button?
  • 0

Advertisements


#2
dsm

dsm

    Member

  • Member
  • PipPip
  • 98 posts
John,
Here is a basic function to covert the contents of all values in a particular field to lower case.
This may help you get started.

David


**************************************************************************
Public Function ConvertToLower()

Dim alpha As String
Dim beta As String
Dim Rs As DAO.Recordset

Set Rs = CurrentDb.OpenRecordset("SELECT tblmembers.email FROM tblmembers")
With Rs
If Not .BOF And Not .EOF Then
.MoveFirst
Do Until .EOF
If !email <> "" Then
alpha = !email
beta = LCase(alpha)
.Edit
!email = beta
.Update
End If
.MoveNext
Loop
End If
End With
Rs.Close

End function
**************************************************************************
  • 0

#3
dsm

dsm

    Member

  • Member
  • PipPip
  • 98 posts
John,
Here is a basic function to covert the contents of all values in a particular field to lower case.
This may help you get started.

David


**************************************************************************
Public Function ConvertToLower()

Dim alpha As String
Dim beta As String
Dim Rs As DAO.Recordset

Set Rs = CurrentDb.OpenRecordset("SELECT tblmembers.email FROM tblmembers")
With Rs
If Not .BOF And Not .EOF Then
.MoveFirst
Do Until .EOF
If !email <> "" Then
alpha = !email
beta = LCase(alpha)
.Edit
!email = beta
.Update
End If
.MoveNext
Loop
End If
End With
Rs.Close

End function
**************************************************************************
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP