Firing off the AfterUpdate event procedure

leanpilar

Registered User.
Local time
Today, 16:20
Joined
Aug 13, 2015
Messages
94
Code:
Dim txtbox As TextBox
Set txtbox = Forms(Me.Text55).Controls(Me.Text0)
txtbox = Me.Text8
 missing after update code
DoCmd.Close

I tried:
Code:
Call txtbox_AfterUpdate
Call txtbox.AfterUpdate
txtbox.AfterUpdate
txtbox_AfterUpdate
Application.Run "Form_" & Me.Text55 & "." & Me.Text0 & "_AfterUpdate"
Application.Run "Form_" & Me.Text55 & "." & Me.Text0 & "_AfterUpdate()"
The problem:
I have 3 form where on some textbox it open a form for auto fill the selected field.
Every thing work good but I have AfterUpdate event on the starting fields that is not fired when it is filled from the other form code.

In the immediate window none of the tries works but only the result of the "Form_" & Me.Text55 & "." & Me.Text0 & "_AfterUpdate" like
Code:
Form_MyForm.Text21_AfterUpdate
it work as it sould
 
You need to make the Private sub Text21_AfterUpdate Public. Then you can call it from another form.
 
If you are trying to call the afterupdate subroutine of one form from a different form I suggest you move the afterupdate code to a module and put it in public sub routine. Then call that subroutine from wherever you need to. If the code references the form then just make them full references, e.g, Forms![TheFormName]!TheControlName
 
You need to make the Private sub Text21_AfterUpdate Public. Then you can call it from another form.

Yes but the format of that call is a bit weird, something like

Call Forms("TheFormName").Text21_AfterUpdate
 
Yes but the format of that call is a bit weird, something like

Call Forms("TheFormName").Text21_AfterUpdate

the problem is that I have 3 forms and on every is more that 20 textbox to fill

When I enter in the box in the new form save the form name in the text55 and the textbox name in the text0 so I call the correct event. and avoid :

Code:
Select Case Me.Text0
Case "Text21"
Call Forms(Me.Text55).Text21_AfterUpdate
Case "Text22"
Call Forms(Me.Text55).Text22_AfterUpdate
....
Case "Text 40"
Call Forms(Me.Text55).Text40_AfterUpdate
End Select
 
the problem is that I have 3 forms and on every is more that 20 textbox to fill

This sounds like a poor design - what exactly are you doing that would require you to set this many other text boxes. This sounds like it should be done with either default values or an update query,
 
This sounds like a poor design - what exactly are you doing that would require you to set this many other text boxes. This sounds like it should be done with either default values or an update query,

I have 1 normal form and 2 manually populated form (the records is a date from a function so the query is not updatable) depend on the filter on that query for 70-100 record in 5 employee is no more than 20 records, one for the opening and one for the closing, on more than half I need to add a new record that is saved on one different tables. The value is one of usually 15 option + value like:
1 new order
1.1 we have all
1.2 get the documents from client:
1.3 give them the bill.
2 repeat order nr :
2.1 ...
2.2 ...
3 finished order
3.1 Customer pay
4....

every button automatically fill the filed from its caption and usually is more than 2 values at the time.
for not write it manually I made a popup form for fill automatically all the common options.

If you have a better solution I will be happy :)
 
I think this would be better handled with combo boxes, that gave you the text choices you needed, and had other columns with the subsequent linked values in them. Having said that I'm not sure you are handling the process flow very efficiently.

Could you post up a picture or two of what occurs on the forms?
 
The first column is the clients name, the seconds is the day summary and the 3rd is the order details, the others are common function-subrutine used.
the day summary is usually avoided by my employee because they have to type a lot in short time so I try to make it faster because it is useful information for the business.

I need a free text to fill like normal because
2/10 times is free enters and the others
4/10 is composite from auto fill and values and
the others are common filled or no need

and as you can see I don't have a lot of space on the screen

the photo is low res so I don't have to hide all the values :D
 

Attachments

  • 20160905_131634.jpg
    20160905_131634.jpg
    66.5 KB · Views: 125

Users who are viewing this thread

Back
Top Bottom