I created an Event Procedure on the After Update event for a control in a continuous form. Basically, if certain conditions are met, I want it to disable another control. It works perfectly, except it is disabling the controls for all the records instead of just that record.
Does anyone know how to get it to just update that record? I've been researching and cannot figure it out!
I have a form that has several sub forms and what I want is that if the user chooses Plan Name in the main form "No Fault" or 'Workers Comp". I want message to pop and go to the field in the subform to enter data but I keep on getting an error.
Private Sub Plan_Name_AfterUpdate() If ([Plan Name] = "No Fault") Then MsgBox "Enter additional information in No Fault form before continuing." DoCmd.GoToControl ([NoFaultWCompsubForm]![Attorney Name]) End If End Sub
It says the action or method requires a control name argument?
I have just made a change to one of the forms by adding a button (by copying the only other button on the form) to cancel any changes and close the form. However, as soon as I added it I started getting the error message in the title. Please attachment LA Err1 for the full message. I also changed the caption on the other button on the form from "Close Form" to "Save && Close Form" this button is now giving the same error.
I have Compacted and repaired the DB on several occasions to no avail. I have deleted the procedures from the module and recreated them using the properties window - still get the error. I have deleted the buttons from the form and recreated the both via the object wizard and without it. Nothing I have tried has made any effect.
I have a continuous subform that shows 2 records consisting of a text field and a yes/no field. I was wondering if it was possible to take the state of one particular of the yes/no fields to trigger an event. Specifically, when one of the questions is checked [true] then I would like to make visible another subform on the main form.
Can this be done, and if so, how, or should I just leave my subform visible at all times?
I have a continuous form with a button 'Cmd1' & a textbox 'txtMail' which is set to visible no.
When the user clicks Cmd1 - then txtMail becomes visible.
I can do it using vba on the buttons click event but when it executes txtMail for all the records become visible.
How do I use a button's click event on the form's current record - Private Sub Form_Current() so that when the user clicks Cmd1 on the current record only txtMail for that record becomes visible.
Can someone help? I am working on an event database (based on Microsoft 2003 event database template). At present when I register attendees, I can preview an invoice which is generated based on the information I have entered.
I have set up another option to preview a Letter of Confirmation based on this same principal. As I am "Visually Basic" challenged, I simply 'copied & pasted' the event procedure and made the changes as needed to ensure the correct report was opened (ie not the Invoice report but Confirmation Letter report).
However, when I click the button to open preview the letter, the "Print Invoice" box also opens up (as it does when previewing the invoice). I don't want this box to open as I don't need to enter any details.
Can someone please have a look at my VBA event below to see what I would need to delete to stop the "Print Invoice" box from popping up.
Private Sub LOC_Click() On Error GoTo Err_ConfirmationLetter_Click If Me![Attendees Subform].Form.RecordsetClone.RecordCount = 0 Then MsgBox "Enter attendee and registration information before previewing the Confirmation Letter." Else DoCmd.OpenReport "ConfirmationLetter", acPreview, , "[RegistrationID]=" & Forms![Attendees]![Attendees Subform].Form![RegistrationID] End If
Exit_ConfirmationLetter_Click: Exit Sub
Err_ConfirmationLetter_Click: If Err <> 2501 Then MsgBox Err.Description End If Resume Exit_ConfirmationLetter_Click End Sub
Many thanks for any help. Kath Price Auckland, New Zealand
PS - Below is the original 'Preview Invoice' event that I copied: Private Sub PreviewInvoice_Click() On Error GoTo Err_PreviewInvoice_Click If Me![Attendees Subform].Form.RecordsetClone.RecordCount = 0 Then MsgBox "Enter attendee and registration information before previewing the invoice." Else DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 DoCmd.OpenReport "Invoice", acPreview, , "[RegistrationID]=" & Forms![Attendees]![Attendees Subform].Form![RegistrationID] End If
Exit_PreviewInvoice_Click: Exit Sub
Err_PreviewInvoice_Click: If Err <> 2501 Then MsgBox Err.Description End If Resume Exit_PreviewInvoice_Click End Sub
In my database I track a program called Bridge. Once you open bridge you can have anywhere from 1 to 7 "Sessions". Each bridge is assigned a number IE LT175A. If there are mulitple sessions they are numbered LT175A, LT175B, LT175C etc. I have a check box in my database that shows if bridge is installed on that PC. If it is then my section for session numbers are visiable, if bridge is not checked then the session numbers section isn't visiable. I currently have my Event Procedure in the After Update section. My code works because if I unclick on bridge my sessions disappears. However when I go to the next record if bridge is checked then my sessions are visiable but on the next record where it isn't checked it still displays the session section. So it isn't adjusting itself from record to record. Does my code need to go someplace else or am I doing something else wrong? Here is the code I have:(and it's under After Update)
Hi I have a problem that has been messing my head up. I want to be able to change the way the tab button works in a continuous form, instead of the tab tabbing across/through a single record first I want to be able to tab down/through the fields. I know this may seem strange to some but that is how I would like it to work. I could change the form to something else but that would require too much alteration and make life harder in the long run.
I currently have some VBA code set to ensure that the field that is select on open has a TabStop and all other fields do not. Is this the correct way of doing it or is there an easier way.
Can you step into an Event Procedure line by line in Access? I toggled the Breakpoint at the End Sub of the Event Procedure, clicked in the middle of the sub, and pressed F8. Nothing! I do this all the time in Excel.
Try this one guys, I have a form based on a Query with Comboboxes reading a Table. the Combo's populate Textboxes with code as:
Private Sub Combobox1_AfterUpdate() Me.Textbox1=Combobox1.Column(1) End Sub
Combo bound to column 1,Row source=table. This was created in Access 2000 and works fine, but when tried in '97 Textboxes are not populating. I cannot figure out what is wrong. (Need it in '97 for work purposes)
I am trying to figure out how to manipulate the On Delte event of a subform. I can delete the record but I need to have fields on the main form reflect the changes. Can any one help me?
Error Message: The expression On Delete you entered as the event property setting produced the following error: A problem occurred while Microsoft Access was communicating with the OLE server or ActiveX Control. *The expression may not result in the name of a macro, thename of a user-defined function, or [Event Procedure]. *There may have been an error evaluating the function, event, or macro.
Basically I think this message is telling me that I can not modify the deleting procedure as I wish too. If this is true can you tell me where I can do that.
here is the very basic code that i am using.
This is the subform code Option Compare Database Dim main As Form_frmOrders
Private Sub Form_Delete(Cancel As Integer) On Error GoTo err Dim wght As Double Dim pallet As Double wght = .Total_Weight.Value pallet = main.Total_Pallets.Value If Weight.Value <> 0 Then wght = wght - Weight.Value MsgBox wght Else pallet = pallet - Quantity.Value MsgBox pallet End If err: MsgBox err Exit Sub End Sub
I am trying to output the following code to a log file. What I am trying to do is when a user opens the database and the switchboard opens up it logs the user to a log file. The code works fine when run from the modules section providing I leave the DoCmd.Output command out. Any thoughts on what I am doing wrong here. This is my code.
Sub ShowUserRosterMultipleUsers() Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim i, j As Long
Set cn = CurrentProject.Connection
' The user roster is exposed as a provider-specific schema rowset ' in the Jet 4.0 OLE DB provider. You have to use a GUID to ' reference the schema, as provider-specific schemas are not ' listed in ADO's type library for schema rowsets
Set rs = cn.OpenSchema(adSchemaProviderSpecific, _ , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
'Output the list of all users in the current database.
I am having trouble with a continuous form setting Enabled to False in the current record only. I have tried code in the OnCurrent of the form and OnOpen, examples like
If Me.NewRecord then Me!Quantity.Enabled = False .....
also
If Me.NewRecord = True then 'if this makes any difference?
Dataentry is set to Yes and have tried No also with no difference.
So I can set all [Quantity].enabled to false but I only want to set the New Record, not all the records I have already created.
Any help would be appreciated as I still have a pretty basic knowledge of Access
I have an "After Update" event procedure for a field on a form that calls a VBA sub. When I use a different VBA sub to input a value in the above mentioned field, the "After Update" event does not occur, even thought the data in the field has been changed. (Of course if I manually enter the data, the field "After Update" event works.)
Is there a flag or condition that needs to be set in my VBA sub to let the field realize that it has been changed? Or possible a way to call the fields AfterUpdate Sub?
I tried having a my sub call the AfterUpdate sub to see what would happen, but didn't get it to work. I got a bunch of error and didn't feel like this was really the way to go.
I also could just duplicate all the code in the AfterUpdate sub for the field, but we all know that that is not a good idea.
I have 3 event procedure with 3 buttons to make them run.I would like to create another button that can run all procedures togehter. if I copy one of the procedures how do I tell it to run the other 2.
I've got two control buttons ('OK' and 'Cancel') on several forms. They work on the forms in Single Form view, but not on the one form that is in Continuous Form view. I couldn't find any mention of this behavior on this forum, but on another forum somebody mentioned that Continuous Form view makes control buttons do odd things. Any ideas on how to handle this?
Here's the code:
Private Sub OK_Click() On Error GoTo Err_OK_Click DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 Me.Visible = False
Exit_OK_Click: Exit Sub
Err_OK_Click: MsgBox Err.Description Resume Exit_OK_Click End Sub
Private Sub Cancel_Click() DoCmd.Close acForm, "Glossary" End Sub
I am having a problem in my access database. I have a a form called Compliance Register. When this window opens it lists all of the requirements of a particular department. There is an ID and Source ID(this field can contain the same number such as multiple 17's). The descriptions match up to what is supposed to be shown. However when I double click on the item, it brings up a Compliance Status window. This is where things go wrong.
It shows the status listed as the first Source ID that matches the number, but does not seem to also be matching up the ID as well It must match both ID and Source ID since Source ID can have the same number multiple times down the list..
Here is what is under the Event Procedure for the double click.
Private Sub ListRequirements_DblClick(Cancel As Integer) On Error GoTo Err_ListRequirements_DblClick Dim stDocName As String Dim stLinkCriteria As String stDocName = "Compliance Status"
[Code] ......
Under stlink criteria, i need it to not only pull the ID, but it has to have a "AND" Source ID. I need it to pull the record that matches BOTH numbers.
Basically I have a continuous form with each record having a textbox and a checkbox. There can only be one checkbox ticked per record but what I want to do is to stop the other checkboxes from being ticked if one is already ticked.
I have a continuous form on which where each record has many controls, including control (A). I wish to set the colour of this control based on the contents of another control (B). Control B is a memo format and is placed behind another control making it hidden. The idea being that the user can then click on control(A) and look at supporting information from Control B on another form.
Conditional formatting cannot be used since this only allows conditions based on the control (A), not (B). Event procedures cannot be used since they all depend on making a record the current record, and I want the user to immediately see when further information is available. When I apply VBA code using an 'on load' event it is action for all records on the form in a way that if only one record has extra information, all records are flagged in this way.
when the Form Property "selectionchange" kicks in?I am trying to use this to run an event procedure. I have a sub form datasheet which contains a date, and when the selection is changed from one record to another in the sub form, I would like to run an event procedure that updates certain fields on the main form, according to the date.I have put msgbox in the event procedure, but it doesn't trigger when the selection is changed? or am I misunderstanding the property?I have also tried got focus, lostfocus, beforeupdate, but they only trigger when the record is changed, not just when the selection is changed.
I'm trying to create a security measure that would prevent a user from accidentally paging down in a form and moving to the next record. I want to create an event macro that would fire if the user accidentally paged down into the next record. The macro would simply move back to the previous record.
What event would I use to build the macro ? What action would return to previous record ?