Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Simple code in Access

Simple code in Access

Simple code in Access


First of all, I am going to admit that I have no idea how to program in VBA. In fact, I don’t even think I entirely understand what Access does. My programming experience has been mostly MATLAB (nothing more than simple loops and conditionals and whatnot, plus the Control System Toolbox, for some reason) and a single introductory course in C++ some years ago. I am also familiar with Excel, although I also don’t know VBA for Excel.

That said, here’s what I’m trying to do.

Let’s say I have a database of however many records. For each record, I have 4 fields labeled as step_1, 2, 3, and 4. I would like to add a 5th column called Status to reflect the state of each entry. So the pseudo-code would be something along the lines of

for each record
If (step_4 != [blank])
Status = “At Step 4”;
elseif (step_3 != [blank])
Status = “At Step 3”;
elseif (step_2 != [blank])
Status = “At Step 2”;
elseif (step_1 != [blank])
Status = “At Step 1”;
Status = “No progress recorded”;

The reason why I need “!= [blank]” is because some of these cells contain the date on which each step happened, while in others, a simple “Yes” or even just a check mark, due to the date not being recorded, but simply that that step had happened.

How would I go about implementing this logic in VBA for Access? Or would a “conditional expression” (whatever that is) make more sense? What f I wanted to do this in Excel?

I’d also like to make a GUI window in which changes can be made to the existing records: when the user enters the Number and Class of the record (required to uniquely identify each record) into two fields, Access pulls up information from the database, some fields being modifiable (the step_1 though 4 fields), some being un-modifiable (the Status field, plus say a Comments field), but only there for information.

It would be great if someone could show me how to achieve either goal without having to go back for a 4-year degree in Computer Science. In fact, it would be even better if someone could show me how to do this without wasting hours and hours on useless online guides only comprehensible to those who no longer need them.

Thanks a bunch,

RE: Simple code in Access

You might wasnt to chekc out Tec-Tips - a sister of this site. That is where the computer geeks live..

RE: Simple code in Access

You don't need to use VBA or to have another field, you can do it all in one query. The 5th column would be an expression that reads the other fields, using an IIF (I think) statement


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close