Event And Form
Jan 24, 2006
I'm having troubles understanding and picking the right event for a particular action in forms. For example I want to set the background of a form to "15911239"; which event do I pick? I know that Oncurrent will work but I don't neccessary want to "set the color" whenever the record changes, because setting it once would be enough. However, onOpen gave me an error (i guess the form isn't open yet, while I'm trying to give it a color). OnActive?
Some light on this matter would be appreciated and an answer to the above example would help too.
Thanks.
View Replies
ADVERTISEMENT
Nov 7, 2006
I have code for a button click event. Essentially I have a main table form that I use to enter customer data and info. I also have a button that I use to add that customer to a separate table that I use for special Customers. My code copies all the data I need copied to my other table, so I wont waste space here typing my code that actually copies the data to the new table. What I will list are the two commands I am using after that code, to close the current form (the one with the button) and open the form for entering special customer information (the form to edit data on my other table). It works flawlessly, but when it opens the other form, it opens to the first record. I want to know how to make it open to the record which I was viewing when I clicked the button to copy the data.
DoCmd.OpenForm "Special Customer Data Entry", , , Number = Me.Number
DoCmd.Close acForm, "Customer Data"
View 9 Replies
View Related
Jun 22, 2005
hi ,
i am new to access ,specially in designing forms .
I have two tables Table1 and Table2 .I have created forms ,Form1 and Form2 respectively.
now what i want is ...when i enter the value in Form2 ...Table1 filed should be updated.
Table1.field1=Table1.field1-Table2.field1
how can i perform this type of action ?
thanks
View 1 Replies
View Related
Nov 29, 2005
I am trying to set a form so ALL text boxes return Proper case. I can get this to work by placing the code on each text box calling a function.....
Private Sub Text0_AfterUpdate()
Dim ctl As Control
For Each ctl In Controls
If ctl.Tag = "*" Then Call Proper
Next ctl
End Sub
``````````````````
the module is
```
Function Proper()
On Error GoTo Proper_Err
Screen.ActiveControl = StrConv(Screen.ActiveControl, 3)
Proper_Exit:
Exit Function
Proper_Err:
MsgBox Error$
Resume Proper_Exit
End Function
`````````````
What I am trying to get to is to have the text box event...Private Sub Text0_AfterUpdate() ...... Be a Form event... So the code would apply to every text box on the form.
Tried it on different form events..... Cant get it to work. Any ideas????
Thanks
View 6 Replies
View Related
Aug 30, 2006
I would like a form I have created to check the value of a text box upon loading the form and also everytime the form loads the next record. Is there an event setting for this? Thank you in advance.
View 1 Replies
View Related
Mar 2, 2005
I wish a label to be visible for only 10 seconds when the call is made to it. I am sure this is basic VB stuff. How can I set it so that when
Me.lblnodateten.Visible = True
is fired, a 10 second counter will kick off and then the line
Me.lblnodateten.Visible = False
will activate
Kindest Regards
View 7 Replies
View Related
Sep 2, 2005
I'm trying to open a form based on another form and have the following code in the Open Event:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_FormOpen
Dim strForm As String
strForm = "frmProductionBatch"
If IsLoaded(strForm) Then
Me.ProductName = Forms![frmProductionBatch]![ProductName]
Me.BatchNum = Forms![frmProductionBatch]![BatchNum]
Else
End If
Exit_FormOpen:
Exit Sub
Err_FormOpen:
MsgBox Err.Description
Resume Exit_FormOpen
End Sub
It works however I get an error message stating that I cannot assign a value to this Object?
What is going on here?
View 2 Replies
View Related
Sep 29, 2005
I have a field (AR#) that has an "on change" event. This is supposed to check through the database and see if that number has been here before (it's like a job # / serial #). It had always worked fine - now suddenly this field, and this field only, reacts VERY, VERY slowly when you type a number in. You can type the number and wait about 5 seconds for it to show up. When I removed the event - it acted normally so I think it has to do with that. Here's the vb for the event:
Private Sub AR__Change()
Dim db As Database
Dim Rst As DAO.Recordset
Dim strAR As String
Set db = CurrentDb()
strAR = Me.AR_.Text
Set Rst = db.OpenRecordset("repairs", dbOpenDynaset)
Rst.FindFirst "[AR#] = '" & strAR & "'"
If Rst.NoMatch Then
Else
MsgBox ("This value it is already in the system !")
End If
End Sub
Any ideas why it's reacting so slow or what I should look for?
View 2 Replies
View Related
Aug 3, 2005
Is there a way to cancel a form's close event? If a user clicks the form's close button, I want a msgbox to ask if they are sure, and if yes continue and close, else cancel the forms close event. I know how to perform the msgbox and the if statement. I can not figure out how to cancel the form's close event.
View 2 Replies
View Related
Jan 20, 2005
I'm using Access 2K. I have created a Form BeforeUpdate event to check that certain fields in the form have been filled. However, I don't want to do the check until after a subform entry is also complete, but the BeforeUpdate event fires as soon as the subform is entered. Is there any way I can around this?
Thanks.
View 2 Replies
View Related
Jun 29, 2006
Hi All,
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!
Thanks in advance for any and all help :)
Krysti
View 3 Replies
View Related
Sep 27, 2006
I have a main form with a subform. I need to update values in the subform when a field on the main form is updated using afterupdate on that control.
Example:
main form name: mainform
control name: gst (on main form)
subform name: subform
records displayed as datasheet.
records field to update: retail
In main form gst control afterupdate event:
Me.[subform].[Form].retail_afterUpdate
Hoping to call the afterUpdate procedure on the retail field.
Error message:
Method or data member not found.
View 2 Replies
View Related
Oct 10, 2006
Hello,
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?
Thank you.
View 12 Replies
View Related
Jun 3, 2015
I have a form with a subform. In the form's On Current event I have the subform's visible property set to false. There is a button that when clicked sets the subform's visible property to true. I want the subform to go to the first control in a new record which is a combo box. the subform is a multiple items form. I have tried the GoToControl in the subforms OnCurrent event, but it is not working. I get an error saying the database cant find a third form.
View 4 Replies
View Related
Jul 19, 2013
I have On Load, Current, After Update events on a form, which all work fine. But, when I add a Before Update, I get the error: "Procedure declaration does not match description of event or procedure having the same name". Following is my code:
Code:
Private Sub Form_Load()
If InStr(Me.Filter, "=") > 0 Then
If IsNumeric(Mid$(Me.Filter, InStr(Me.Filter, "=") + 1, Len(Me.Filter) - InStr(Me.Filter, "="))) Then
Me.Tag = (Mid$(Me.Filter, InStr(Me.Filter, "=") + 1, Len(Me.Filter) - InStr(Me.Filter, "=")))
End If
End If
[code]....
View 3 Replies
View Related
Sep 11, 2013
I need to close a form after checking a condition in the Form_Open event.
I expected that by setting Cancel = True that the form will close but this does not happen.
DoCmd.Close also does not close the form.
View 4 Replies
View Related
Oct 24, 2012
I would like to know how to refresh a form on closing event. The forms name is frmDeparturesPaymentScreen. I want to do this in a macro...
View 2 Replies
View Related
Mar 7, 2014
I have a main Part form and a Spec subform linked via Part key.
I need to add 6 Spec records automatically when a new Part is added so user can select desired Specs (default value is "n/a" for al 6 entries).
Right now I have the Spec entries added in AfterInsert for Part form, but I have to navigate out and back into record to trigger Part insert. I cannot add the Spec entries until the Part entry is added.
Is a command button my only option? Or is there another way?
AfterInsert is too late, and BeforeInsert is too early; that gets triggered as soon as the first character is typed in Part name.
View 2 Replies
View Related
Nov 14, 2014
I have an order form with an order details sub form. Both are bound to their respective tables and function correctly, with the OrderID being inserted automatically into the order details table.
However I am using VBA to update and check stock and have it working when attached to a separate form called process orders. Which event would be the best place to place this code. I do not really want to have the process orders form. Would it be on the master form or the sub form. I thought of placing it in the after insert event on the subform, but there can be many order items per order and it will run before I have finished adding order items. I tried it in the after insert event on the master form, but I think that this will run the code too soon as at this stage the order details will not have been written to that table.
View 4 Replies
View Related
Aug 12, 2014
I've taken a break from Access for a while, but I'm back at it again and having some difficulty. I am trying to open a form with a timer to state that the database is going to shut down in five minutes if they don't respond. I'm obviously using the wrong code. I've been trying to use the following:
Private Sub Form_Timer()
DoCmd.OpenForm "frmWarning"
If Forms!frmHidden!chkActive Then
Forms!frmHidden!chkActive = False
Me.TimerInterval = 300000
Else
DoCmd.Quit
End If
End Sub
It crashes on the 'DoCmd.OpenForm "frmWarning"'
View 3 Replies
View Related
Jul 7, 2015
I have a form in which job times for individuals is entered. As the data is entered, a macro fires to calculate various costs (Nat Ins/Pension/Total cost etc etc), and that data is stored in a table.
I now have written code to enable the inputting of the data into the database directly from the Excel sheet in which the data is first entered - this is great as it cuts out a data entry repeat and will be a big big time saver.
View 9 Replies
View Related
Jul 28, 2015
I have error 438 Object doesn't support property or method in a Form On Current event.
Error trapping is turned on, reason being I converted the form to accde and it stopped working!
The code is...
Private Sub Form_Current()
On Error Resume Next
Dim ctl As Control
'Me.CC_Spare_3.Enabled = False
For Each ctl In Me.Controls
[Code] ....
The highlighted text when in debugger is
ctl.Locked = Me![Check411]
View 4 Replies
View Related
Apr 20, 2015
I want to call the "On Current" event of another form.
I have a parent(mainform) form and then I have a subform(CurrentForm) and in that subform(CurrentForm) I have another subform(mysubtab01). From the mySubTab01, I want to call the On Current of the parent form. How can i do this?
This is an example of how I am setting the record source of the deepest subform where I want to call the parent on current from:
Forms(mainform)(CurrentForm)(mySubTab01).Form.Reco rdSource = "Select * from subQrytab03"
View 12 Replies
View Related
Jan 7, 2013
I have parent form and child subform. one field in the parentform is calculated on sum of records on the childsubform when the parent form loads initially the value in the calculatedfield is 0 then it shows the correct value when the childsubform value is populated i have another-field i want to change the property of the onotherfield.backcolor= RGB(0,0,255) when calculatedfield.value<0 but its taking the initial value(0) not the calculated onewhich event shall i invoke on the form so that it waits the subform to complete then fires ... i tried current, load, activate events .. with no success.
View 2 Replies
View Related
Sep 28, 2005
Hello:
Is it possible to call a form event (actually a control's event within the form) from another form?
Thanks in advance.
View 6 Replies
View Related
Sep 20, 2005
Hi,
I have a form with some bound fields and some unbound fields. If I make any change to the bound fields I can use the "Before update" event to perform some actions when a user tries to move onto a new record.
What I now need is if a user doesn't make any change to the bound fields but makes a change to an unbound field - how can I check this before the next record is displayed. Is there any event I can use? Each time a user tries to move to a new record I want to check first if they have added anything to an unbound field.
Users can move onto the next record using buttons or the record navigator at the end of the form.
Many Thanks,
View 8 Replies
View Related