Erorr When Running Code

Apr 11, 2005

I am getting an error 'Run time error 2001, You canceled the previous Operation'. I don't know where I am makin a mistake in this code. I hope you guys will figure it out.

Private Sub Form_Load()

'On Load of the switchboard check Jobs table for any uncompleted jobs

Dim intStore As Integer

'Count of uncomplete jobs that are past the Expected Completion Date
intStore = DCount("[ID]", "[Sheet2]", "[Follow up date] <=Now() AND [Appointment Reminder] =0")

'If count of uncomplete jobs is zero display switchboard
'Else display message box detailing amount of jobs
'and give the user the option as to whether to view these or not.
If intStore = 0 Then
Exit Sub
Else
If MsgBox("There are " & intStore & " uncompleted jobs" & _
vbCrLf & vbCrLf & "Would you like to see these now?", _
vbYesNo, "You Have Uncomplete Jobs...") = vbYes Then
DoCmd.Minimize
DoCmd.OpenForm "Reminder", acNormal
Else
Exit Sub
End If
End If
End Sub

View Replies


ADVERTISEMENT

Error Running Code

Sep 29, 2006

Hi,
I get this error when trying to rung a piece of code:
The expression On Load you entered as the event property setting produced the following error: Member already exists in an object module from which this object module derives.

I have the EXACT same code working on other forms using different fields and I just can't figure out why this particular one isn't working, it's driving me nuts!
My code is this:
Private Sub Form_Load()
Dim strReason As String

strReason2 = Nz(Ref3Poor_Reason, " ")

Select Case strReason3
Case "Not Known", "Unwilling to Give"
Poor1NavRef3.Visible = False
Poor2NavRef3.Visible = True

Case Else
Poor2NavRef3.Visible = False
Poor1NavRef3.Visible = True

End Select

Dim Ref3PoorCheck As Boolean
Ref3PoorCheck = Ref3Poor_Reference

Select Case Ref3PoorCheck

Case "True"
Ref3Poor_Reason.Visible = True

Case "False"
Ref3Poor_Reason.Visible = False

End Select

End Sub

Can anybody tell me where I'm going wrong please?
Thanks,
Dan

View 1 Replies View Related

Running Code When Data Changes In A Table

Oct 25, 2005

Hi

Ive made a booking system in Access and need to convert it so it can handle multiple users on a network. The problem i have is that when someone selects a block of time on one computer i need the other systems to lock out those blocks on their screens. I have a table which records each user's activities so i could always use the On Counter event on the form to repeatedly check if there is any blocks to be locked out according to data in that table. The obvious problem with this is the huge overhead.

Is there any other way round this? or is there any way of detecting changes to data in a table so that i can run code to lock out the blocks only when theres a change?

Any help or suggestions much appreciated! :)

View 1 Replies View Related

Stop Code Running If Fields Blank

Nov 29, 2006

Ok - really need some help here. I have searched and searched but i think my problem is slightly different to the ones i am finding.

Basically i have a form and i want to force users to fill in one out of 4 tick boxes. If none of them are ticked when they press the close button i want the form to stay open and a message box come up.

I can get the message box part to work but the form still closes down.

The reason for this is that when the form closes it goes to another form that is linked to it by a unique ID number. This works by the following code.

Private Sub BTN_INVIS_Click()

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm closure"

stLinkCriteria = "[issue ID]=" & Me![Issue ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_BTN_INVIS_Click:
Exit Sub

Err_BTN_INVIS_Click:
MsgBox Err.Description
Resume Exit_BTN_INVIS_Click

End Sub

What i have tried to do is insert a piece of code into the above to generate the message box so it now looks as follows:

Private Sub BTN_INVIS_Click()

If [Transport_Delivery_issue_] = False And [Process_issue_] = False And [Design_issue_] = False And [Supplier_issue_] = False Then

MsgBox "You must complete the liability box before you can close this issue"

Cancel = True

[Design_issue_].SetFocus

End If

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm closure"

stLinkCriteria = "[issue ID]=" & Me![Issue ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_BTN_INVIS_Click:
Exit Sub

Err_BTN_INVIS_Click:
MsgBox Err.Description
Resume Exit_BTN_INVIS_Click

End Sub

This code checks the boxes and generates the message box if none are ticked - that works great. However it doesnt stop the second part of the code (the move to the next form) from executing if the boxes arent ticked.

Would really appreciate it if someone could help me - i'm fairly new to coding so the whole database is a bit cobbled together (mostly with help from this forum!).

View 3 Replies View Related

Modules & VBA :: Code To Find Out If Another Program Is Running?

May 19, 2014

I found code at this website that is supposed to determine if a specific program is running on your computer. I have a couple questions about the code here. One, when I run it just the way it is and call it in the immediate window with the ?fIsAppRunning("word") command, it tells me "True" whether I have Microsoft Word open or not.

My other question is this: After the code is working properly, how can I add new programs to it? There are two programs the end user might need open to complete a process. One is called Extra and one is called tn3270 (this is how they show up in the Processes tab of the Task Manager). I think in order to add them to this code, I need to know a "class" to associate with them.

View 1 Replies View Related

Forms :: Running Code On Individual Records

Mar 20, 2015

So in my database i'm creating a live form that will open up a list of patients and when they are seen. one of the bits is a button that before they arrive says "Not Arrived" and after they arrive it says "Arrived". The code works fine:

Code:
Private Sub Command68_Click()
Dim C1 As String
Dim C2 As String

[code]...

The problem is after clicking the button on any of the records, it changes the text on all records, to wit: I tried to attach images or links to images, but my post-count is too low. The before-click screenshot is /3QnBkgG on imgur. The after-click screenshot is 9VZWzzp on the same site.

Bear in mind I've only clicked the button (it's white, so it doesn't look like a button) on the top record.The form is set to continuous forms, not sure if that has anything to do with it.how I can get the code to run on individual records, rather than applying the first-record's results across all records?

View 12 Replies View Related

Why Format Event Code Running On First Record Only

Aug 28, 2013

I have a report with several sub reports that run and fill a table conditionally. The third sub report displays the records from this table. It works perfectly.

If I print a batch of records, it also works perfectly - but only for the first record. Previously, I had another report with several sub reports where the visibility of objects were controlled - this worked fine in a batch. Every subreport had the correct visibility settings.

In this case, I have a similar design, but instead of setting visibility on the various subreports, I am filling a table based on data in the subreport. As stated it works great for the first one in the group, or any single print.

View 4 Replies View Related

Forms :: Create A Message Box To Flash On Screen To Tell User That Update Code Is Running

Mar 6, 2014

I need to create a message box or a form or something to flash on the screen to tell the user that a piece of "Update" code is running. the update code will be updated reports from marketing returns, but the 3 branches who use the information are separate so I am creating an update form to download and update the table.

The code for the update is already working, but can take a while, so I thought a message or splash screen would be useful as the update runs on start up.

It would have another use, I have a report which is made mainly of calculated fields on an onPrint event and also takes a while to work it out, so a similar screen would be more useful than my current spinning circle and blank screen.

View 1 Replies View Related

Forms :: How To Use Data On A Form When Running Code Before Closing The Form

Feb 4, 2014

I have a bound form with a few fields. I would like to run a sub after some of these fields are modified, but not others. I would like it to run only once, after user finishes his work on the form.

When using the Unload event - the form on the form is not there anymore (or did I get something wrong?).

Is there a way to trap Data on form just before the form closes?

View 4 Replies View Related

Forms :: Making Forms Invisible When Code Is Running

Jan 12, 2015

I'm opening forms to get data then closing using VB code.

Is there a way to stop the screen showing these forms as the code runs

something like Display refresh off then display refresh on.

Just to hide my workings.

View 1 Replies View Related

Running Some Code When "x"-ing Out Of Form

Jun 21, 2006

If a user "x'-es out of a form, is there a way to run some code to do a little process before the form is totally shut down?

If there is a way to do that, would someone please advise how it's done?

Thanks a million! You guys and gals are the best!

View 3 Replies View Related

Running Balance As Opposed To Running Total

Mar 14, 2005

Can anyone tell me how to get a running balance on a report. I know how to create a running total, by setting the "running sum" property of a text box to "Over all".

I can't however see how I can adapt this to give a running balance (as in a bank statement for example). Attempts to do so end up in failure!!

Many thanks in advance.
Peter

View 2 Replies View Related

Please Review This Code, (simple Code) New With Codes

Feb 16, 2006

Works great, but when I hit the number "3", (3 times in row) it will let me into the form. I want it to not let me in IF I don't know the password.

Where did I go wrong?

Private Sub Form_Load()
Dim pw As Variant

If InputBox("What is the password?", "Password") = "1" Then
Else
MsgBox "Invalid Password", vbCritical, "Sorry Charlie"
DoCmd.Close
If InputBox("What is the password?", "Password") = "2" Then
Else
MsgBox "Invalid Password", vbCritical, "Sorry Charlie"
DoCmd.Close
End If
End If


End Sub

View 14 Replies View Related

Using Code To Unprotect And Protect Viewing Code

Jan 14, 2007

I protect my code from people being able to read it by setting a password on the code from Tools > Properties, selecting the Protection tab and entering a password, and clicking "Lock Project"

Is there a way to write code that will remove that Lock Project check and check it back on?

I've looked through the Application.SetOption command and it doesn't seem to be one of the choices. It would be very helpful if someone knew how to do this.

Thanks

SHADOW

View 6 Replies View Related

Running SQL From Another SQL

Oct 8, 2005

Hi

I want to open a DAO.Recordset from an opened DAO.Recordset.

My code is like this

Dim db As DAO.Database
Dim rs, rsMarks As DAO.Recordset
Dim strSQL, strMarks As String

Set db = CurrentDb()

strSQL = "SELECT Name, SurName, Marks from Table1"
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)

strMarks = "Select Sum(Marks) As MarksSum from rs"
Set rsMarks = db.OpenRecordset(strMarks, dbOpenSnapshot)

rs.MoveFirst
Me.txtName = rs!Name
Me.txtMarks = rs!Marks
Me.txtSurName = rs!SurName

rsMarks.MoveFirst
Me.txtMarksSum = rsSur!MarksSum

rs.Close
rsSur.Close
db.Close
Set rs = Nothing
Set rsSur = Nothing
Set db = Nothing

But I got an error message “The Microsoft Jet Database engine can not find the input table or query ‘rs’. Make sure input table or query exist”

While without this second 'rsMarks' my first SQL 'rs' works well

I will be grateful if any one help me.

Regards

Rahulgty

View 7 Replies View Related

Running Sum

May 15, 2006

Is there a function for cumulative row for use in querys (calculated field) or in a code - something like "running sum" in reports?

View 2 Replies View Related

Running Sum Help

Apr 12, 2005

Forgive the Bonehead question. I know this is probably easy, and may have been answered before, but I'm under the gun and trying to get this done quickly.

I have a form that is populated from a table. Each record has a Yes/No value (called "Matched") and a $ amount (called "PaymentAmount"). When they open the form, all the "Matched" records are a No (or False) value. I want a Text Box called "Total_Matched" to keep a running total of all "PaymentAmount" when they check the "Matched" field.

Does this make sense?

I have done a query that gives a sum of PaymentAmount from the table where all values are "True", but I can't get it to requery each time they check the boxes. And I can get a Total of all values on the form (=Sum([PaymentAmount]) but I can't make it contingent on if the Matched field is true.

Any help is greatly appreciated. I'm off to search some more.

Thanks.

View 1 Replies View Related

Slow Running

Jun 24, 2005

I am using Access 2003 but it is to slow, what can I do?

View 1 Replies View Related

Running Nero Api

Jan 23, 2006

Hi Folks,

I want to automate the Nero burner from a Microsoft Office Access Database. I have the code to close the DB and then open the nero program, but i dont know how to actually run a complete burning action from the same click of a button in the DB. I'm working from a macro at the moment but open to suggestions... batch files etc

Cheers Oldtimer

View 1 Replies View Related

Is Database Running?

Aug 2, 2006

Question:
Is it possible to see if a database has stopped running (errored out, timed out, or if code builder is open) thru another database. I know how to look for the .LDB file to see if the database is open...but is it possible to know if it's broken?

The reason I ask is that I have a database on a pc (can't be put on a network) that updates/refreshes every 5 minutes. Once in awhile someone will do something and cause the database to halt (code builder window opens). Currently the way I check to see if the database is running is to VNC onto the pc from my pc and see if it's running. Does this make since?

DT

View 2 Replies View Related

I've Got The RUNNING SUM Blues!!!

Feb 12, 2007

Hello,

I have a report which is similar to a bank statement. I have a transaction date and then either a credit or debit depending on whether the customer made a payment or if I am invoicing them.


I have created an additional field in the report which calculates AmountDue - TotalPaymentAmount and called this field Balance.
I then attributed a running sum based on this Balance field.
This works great.................BUT!!!!!
If a customer has 100 transactions the report will be well over 10 pages long.
Is there a way I can limit the report to just perhaps the most recent 20 transactions or 20 days?

I tried and failed in the report's query retrieve the payments which occur >datenow(-20) (basically in the last 20 days). This worked ok in the sense that only the last 20 days worth of transactions appeared in the report......BUT!......the first running sum of the report does not carry over from the previous transaction..it starts from 0!!!!

Please help me get over the RUNNING SUM blues!
Rob

View 4 Replies View Related

Running A Sub From Switchboard

Dec 11, 2007

Hi there!I am having a fair amount of trouble figuring this out, and I was hoping someone might know what I was doing wrong. Someone set up a switchboard (I think using the Switchboard wizard) in this Access DB. I've since taken on the project of automating a database process and I want to use a switchboard item so it's a one-click, otherwise mostly automatic process. I have added the switchboard item, and when I click on it I get a msgbox displaying with my test text, so I think that is set up OK.Right now, I am trying to have a click on the button launch a custom sub (that I still have to write). Right now all I have in that sub is another call to a Msgbox with other testing text.Following is the relevant VBA code - not all of it, but I think this is all that will be involved. runDeletions() is located in its own module "Module3":The Sub:Public Sub runDeletions() MsgBox "testing - runDeletions ran successfully" End Sub This is the code in the switchboard form that deals with the arguments taken - and that will call the above function. Code within Private Function HandleButtonClick(intBtn As Integer): '...have the argument set to 8...Const conCmdRunCode = 8 '... so this Case will run:Case conCmdRunCode ' optional, just tells me the value of the argument being used' MsgBox rs![Argument] 'actually is what tries to call the Sub Application.Run rs![Argument] I've found the Switchboard Items table, and added in the following record. It hasSwitchboardID as: 3 (this button is on its own page)ItemNumber as: 1Itemtext as: Run Pending DeletionsCommand as: 8Argument as: Module3.runDeletions()I'm pretty sure my Argument is wrong. I've tried a few things but can't figure it out. What could I use as my Argument so my sub runDeletions in my module Module3 will run when this button is clicked?Thanks!PS - I've also posted this question here: http://www.vbaexpress.com/forum/showthread.php?t=16611 and any differences in code are intentional, as I keep trying different things (but so far no luck)...

View 3 Replies View Related

Outlook Running?

Jan 27, 2008

Hi,

I'm sending an e-mail each time a spesific report is made. If the user has'nt opened Outlook, it is placed in Outlook's Outbox, and is sent first when the user opens Outlook. Can I somehow start Outlook using VBA so the email gets sent when the report is run?

Also, The user is prompted with a warning message that an application tries to send an email. The user has to allow this for the mail to be sent. I know this is a security matter so no applicatopn can send emails without the user knowing. Is there someway to do this without the warning?

I'm using WXP and A2K3

Thanks in advance.

View 5 Replies View Related

Running Minimised

Feb 26, 2008

Hi Chaps

Probably one of those numpy questions but does anyone know how to run a database minimised?

I have a scheduled task that needs to run every 30 minutes which it does beautifully, however the database window pops up over whatever I'm doing at the time.

Not a huge problem but if anyone has a solution?

Extra info: The scheduled task calls a .bat file that runs the database and transfers data to a web site.

Thanks

Paul

View 4 Replies View Related

Running Sum In Query Possible?

Sep 16, 2005

Hi!

Sorry I am to bother you. But I was wondering whether it is possible to create a running sum in a query (from each previous record just a simple add up)?

I know how to do in report (it is described in the help function) but for a query I cannot find anything.

Thx and rgds,
Lobhaan

View 2 Replies View Related

Running Sum Query

Feb 16, 2006

have a table, Loans.

Fields:
ID (key)
Loan Number
Principal Balance.

I have another table, Transaction, that's based off the Loan Number field on the loans table.

Fields:
LoanNumber
Payment Type (2 choices, payment and advance)
Amount

I have a user form where users can specify the payment type, and amount, based on a certain loan number.

I'm attempting to do this:

User enters a transaction into the database. once the transaction is entered, the Principal Balance field for the specified loan number is updated.

If the payment type is advance, the query will subtract the amount from principalbalnce. if payment, the query wll add the amount to the principal balance.


Here's what I have so far.

The userform updates the transactions table with the information correctly.

My next step is to update the principal balance.

I'm thinking I could use some sort of update query, but I don't know where to begin.

HELP!!

If there is a better (normalized) way to accomplish this, I'm definitely open to ideas. Please just provide a basic example so I can understand. :o :cool:

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved