?
Solved

How to update a recordset with a string variable as the column name

Posted on 2011-03-21
3
Medium Priority
?
309 Views
Last Modified: 2012-06-27
Using Access VBA I have the following code:

        For Each i In squares
            updating = CStr(i)
            currValue = Nz(mrs![0])
            If currValue = "" Then currValue = 0
            mrs.Edit
            mrs!updating = currValue + 1
            mrs.Update
        Next

my recordset is quite large, it has 255 columns.  The i value I have here is the column name I am looking for (a number).  when I do mrs!updating it doesn't seem to like it.  Is there away to do this?  I cant explicitly write out each column name because there are so many but the array has what I need to update and how many to add to each column.

Thanks, hope that makes sense.
0
Comment
Question by:JeffreyDurham
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 35186768
Maybe this:


        For Each i In squares
            updating = CStr(i)
            currValue = Nz(mrs![0])
            If currValue = "" Then currValue = 0
            mrs.Edit
            mrs(updating) = currValue + 1
            mrs.Update
        Next

mx
0
 

Author Closing Comment

by:JeffreyDurham
ID: 35186778
thanks!!
0
 
LVL 75
ID: 35186789
You are welcome.

Thank you for using Experts Exchange ...

mx
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question