Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Ephrata, Washington, USA
    Posts
    683
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating a macro to edit records (97 Sr2)

    Ok. I'm lost here. I've been asked to create a macro or write code that will open a database table and clear the check box field for a specific number of consecutive records (a number that the user will enter when he runs the code - for example, delete the last 35 check marks).

    I am very very very new to VBA, and I need help, please. I am visualizing a shortcut on the user's desktop that will launch a dialog box, into which he will enter the number of records (ex: 35). Then, the code will open the access database table and clear the check box field for that number of records (starting with the last record in the database). This table currently has about 3000 records in it, and daily it is updated with more records. Each record has a checkbox field, which is turned on. We want to turn OFF the check box for the day's records. Why?

    It's complicated, but the user has said that after the code unchecks the specified number of records (and exits the database), he will then open another program that extracts a copy of those unchecked records and manipulates them in that program. After that program does its thing, it is set already to put the check marks back in the Access database table.

    Does this make sense? Can you point me in the right direction. I am in my 2nd week of learning VB.NET, and I have a couple of VBA books. So, I may need some hand holding on this.

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Creating a macro to edit records (97 Sr2)

    I'm <img src=/S/confused.gif border=0 alt=confused width=15 height=20>. On the one hand you say you want to uncheck the last nn records, and on the other hand you say you want to uncheck the check box for the day's records.
    If it is the day's records you wish to clear you should probably put a date field into the table with today's date. Thne just clear the checkbox by today's date.

    To do it from the desktop all you need is to have a shortcut to an Access database to a particular form and have the form accept the number (if that's what you want), the program will then do it's thing and bounce out of the database. You will need to sort by a particular field to read the table backwards.

    HTH
    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating a macro to edit records (97 Sr2)

    Users rarely understand exactly what they're asking for, so they have a hard time explaining it to the person who has to build it. The "last" howevermany records has no real meaning in Access. If the user wants the *latest* records, then you need to do as Patt says and make sure there is a date field in the table that will allow you to determine when the records were created. That isn't at all the same as allowing the user to enter a number of rows to check or uncheck however, so be sure and nail down the exact specifications before you build anything.

    This whole checkbox business strongly suggests someone who is used to spreadsheets and is unfamiliar with Access's capabilities. I don't see any particular reason why records which need to be "extracted" and manipulated in another application need checkboxes for this purpose in Access. On the other hand, if there is NO date field in the table, then the checkbox is probably the only method anyone could think of for identifying the records to be extracted.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •