Question about Macro and deleting records with one!

Jonathanw

Board Regular
Joined
May 3, 2004
Messages
73
Hi, it's me again, the Access Newbie!! - To re-cap for those that don't know me, I have "inherited" an Access DB, used throughout our european organisation to manage Marketing activities. This is all well and good, except that I consider myself an intermediate access user, and need to add some Advanced features!!

OK. There are 2 main tables (Main and Item/Cost), I/C is a sub-form of Main, the entries I am concerned with are in Main. here I have an approval process, whereby a manager must click an approved button, then a password, then the status is set to Approved. I want this to do a number of things, main one being Lock Item/Cost so no more additions can be made.

Currently this is the code
Private Sub Command161_Click()
Dim stPassword2 As String

stPassword2 = InputBox("Enter Password")
If stPassword2 = Record_Number Then
Status.Value = "Approved"
Else
Status.Value = "Incomplete"
End If
End Sub

my question here is how do I lock the Item/cost, I understand this is a variable in the Form itself, but I am unsure how to set it.

My second query is, I have a delete button, which runs a macro to delete records. This pops up a message box, with a warning, then access pops up a message with a warning. How though do I disable the button if the record is approved? - I don't want them deleting approved items.

---

I know this is a lot to ask, and in the past have found trawling this site is a real gold mine. Any help people can provide would be gladly appreciated.
Regards

JonathanW
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I don't have time to wite the code at the moment but to control the edits you can add code th the current event of the form that switches the value of the subform "Recordset Type" between Snapshot and Dynaset depending on the value of status.

To stop deletions you need to convert the macro to code and then you can check the value of "status" before running the code.

If you get stuck shout again and hopefully someone will do you some code or I will try to look in later this PM

Peter
 
Upvote 0

Forum statistics

Threads
1,221,773
Messages
6,161,855
Members
451,724
Latest member
sledparty

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top