Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Simple code in Access

Status
Not open for further replies.

shimo1989

Mechanical
Apr 4, 2010
30
0
0
CA
Hello,

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”;
else
Status = “No progress recorded”;
end

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,
 
Replies continue below

Recommended for you

Status
Not open for further replies.
Back
Top