Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do simple row or cursor processing using VBasic in Access 1

Status
Not open for further replies.

MacAye

Programmer
May 4, 2004
4
US
This should be really simple but I can't figure it out.

In an Access VBasic (VBA) module, process each record-row:

1. examining each record-row for contents in specific columns-fields (simple parsing)

2. changing the contents of specific columns-fields based on the logic results.

The database is in MS SQL. I can open it in Access just fine.

I've written this code in VBasic outside of Access, I've written it in Crystal Reports, and I know how to do it in Cold Fusion. I've read most of the 1400 pages of Jennings' "Special Edition Using ... Access 2003". I've looked all over this Forum.

What I cannot figure out is how I connect to and "see" each record as it's read, run looping logic against slected columns-fields, change them, and update the record-row in the database.

I'm probably expecting to see invocation and interface parameters that either don't exist in VBA for Access or are used in a way that looks foreign to me. For example, the VBA editor doesn't show me the column names as selectable variables the way Cold Fusion and Crystal Reports do.

Anyone got some model code that would show me how to wrtie this very simple module?
 
Have a look at Recordset (either DAO or ADO).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 

set RST=currentdb.openrecordset("MYQuery")
do while rst.EOF = false
if rst!field1="string1" then
rst!field1="String2"
else
rst!field1="String3"
end if
if rst!field2>3 then rst!field2=rst!field2-3
loop

 
I thank the two who replied. My conclusion is that Access lacks the kind of straight-forward cursor (aka, row or record) processing needed for this data cleaning operation. So it's back to basics, so to speak, with XBasic. And the manual isn't 1,400 pages long! I've also tripped over AlphaFive that seems to be a good Access alternative. It appears to provide this level of API, but I discoverd it after I started my Basic code. I'll probably try it on a later project.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top