Jump to content

Visual Basic help (lol) Access field edit

Hey,

 

Yes, I know. Visual Basic is easy but I've never done a program with an access database. What I am trying to do, is this:

 

When a button is clicked, a record in the database in changed from yes to no and vice versa. So it has to change that, it's a checkbox to see if the member of staff is in or not. Another thing is, I need it to also add the current date to another row. What functions do I need to use to achieve this? I'm bad with coding. Furthermore, I have to revert changes when the member of staff signs out.

See my blog for amusing encounters from IT workplace: http://linustechtips.com/main/blog/585-life-of-a-techie/

Link to comment
https://linustechtips.com/topic/399642-visual-basic-help-lol-access-field-edit/
Share on other sites

Link to post
Share on other sites

Well now that's a very convoluted question that sounds quite a bit like homework or an assignment...

 

I would suggest that you revise what it is that you are trying to ask. Break it down piece by piece, use better grammar and pose the question again.

 

In the meantime you can look at this post where I have described the procedure on how to connect to Access databases using the .NET Framework and some of the caveats involved. You can use some or all of the classes that I have listed and you can choose to use them in the visual designer or directly in the code... it's your choice.

The single biggest problem in communication is the illusion that it has taken place.

Link to post
Share on other sites

Not sure what version of access you're using (or if the version matters much) but I hope the following helps.

 

When a button is clicked, a record in the database in changed from yes to no and vice versa.

 

Sounds like an update.

 

Another thing is, I need it to also add the current date to another row.

 

Also sounds like another update but just in case, here's an insert.

 

Furthermore, I have to revert changes when the member of staff signs out.

 

This will depend on how you build your application. You may not need to do anything if your application doesn't change the database unless the user confirms/saves the changes. If however you do need to revert changes, one option is to use a transaction. Another is to manually keep track of the changes and to update/delete rows to what they previously were.

Link to post
Share on other sites

-snip-

 

Omg seriously!? it's really freaky because I had literally added mention of the transaction + CRUD to my own post but had removed them after reading it thought because I thought it was too much for him at this point.

 

But your're right he could learn a lot from hand rolling queries like that.

 

In any event there's also Entity Framework and NHibernate (both can be garbed as NuGet packages) to consider for database modelling/abstraction - though I suspect that's a little overkill for the stage you are at.

The single biggest problem in communication is the illusion that it has taken place.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×