AfterUpdate

irade92

Registered User.
Local time
Today, 18:57
Joined
Dec 26, 2010
Messages
229
Hi
I have two form, the small one and the bigger one. From small one wit double click of a mouse I transferred value to bigger form. See Pic1. After I move mouse to bigger form I get this See Pic2. I put the mouse at the end of a control to avoid black selected. see pic3. On Enter AfterUpdate give me result as the field is empty. What I do is clear last number and retype the last number and then AfterUpdate is functioning...see pic4. What should I do to avoid all this
Thanks
 

Attachments

  • pic1.jpg
    pic1.jpg
    229.3 KB · Views: 189
  • pic2.jpg
    pic2.jpg
    175 KB · Views: 178
  • pic3.jpg
    pic3.jpg
    181.4 KB · Views: 148
  • pic4.jpg
    pic4.jpg
    169.5 KB · Views: 184
  • pic5.jpg
    pic5.jpg
    150.1 KB · Views: 132
What is the code you use to transfer the value to the bigger form (Pic1 -> Pic2) ?
 
What is the code you use to transfer the value to the bigger form (Pic1 -> Pic2) ?


Code Tags Added by UG
Please use Code Tags when posting VBA Code
https://www.access-programmers.co.u...e-use-code-tags-when-posting-vba-code.240420/
Please feel free to Remove this Comment
Code:
Private Sub mE_BROJ_DblClick(Cancel As Integer)
    On Error GoTo greska
  
    [Forms]![frmSMETKI_MAIN_3]![fsubSMETKI_MAIN_3]![br_recept] = mE_BROJ
    [Forms]![frmSMETKI_MAIN_3]![fsubSMETKI_MAIN_3]![br_recept].SetFocus
    [Forms]![frmSMETKI_MAIN_3]![fsubSMETKI_MAIN_3]![br_recept].Requery
     
  
    Cancel = True
greska:
    Resume Next
End Sub
 
Last edited by a moderator:
Why are you setting Cancel = True?

In fsubSMETKI_MAIN_3 change the declaration of br_recept_AfterUpdate to Public
Code:
Public Sub br_recept_AfterUpdate()
' ...
End Sub

Then modify your code:
Code:
Private Sub mE_BROJ_DblClick(Cancel As Integer)
On Error GoTo greska

  With Forms.frmSMETKI_MAIN_3.fsubSMETKI_MAIN_3.Form
    .br_recept = Me.mE_BROJ
    .br_recept_AfterUpdate
    .Requery
    .br_recept.SetFocus
    .br_recept.SelStart = Len(.br_recept & vbNullString)
  End With

greska:
  Resume Next
End Sub

hth,

d
 
Why are you setting Cancel = True?

In fsubSMETKI_MAIN_3 change the declaration of br_recept_AfterUpdate to Public
Code:
Public Sub br_recept_AfterUpdate()
' ...
End Sub

Then modify your code:
Code:
Private Sub mE_BROJ_DblClick(Cancel As Integer)
On Error GoTo greska

  With Forms.frmSMETKI_MAIN_3.fsubSMETKI_MAIN_3.Form
    .br_recept = Me.mE_BROJ
    .br_recept_AfterUpdate
    .Requery
    .br_recept.SetFocus
    .br_recept.SelStart = Len(.br_recept & vbNullString)
  End With

greska:
  Resume Next
End Sub

hth,

d
well..great solution..but only one change..I need to press Enter If I want to execute afterUpdate..In this case now it automaticaly invoke AfterUpdate.. Why I need to press Enter..becouse there will be more recepts And I need to chose which one to realize...So please do a little change
 
OK,

Comment out the line:
Code:
    .br_recept_AfterUpdate
to:
Code:
'    .br_recept_AfterUpdate
See if you are then able to press Enter and the AfterUpdate will run.

hth,

d
 
OK,

Comment out the line:
Code:
    .br_recept_AfterUpdate
to:
Code:
'    .br_recept_AfterUpdate
See if you are then able to press Enter and the AfterUpdate will run.

hth,

d
I have already tried it .but the same efect as in previous pic I send
 
Try also to comment out .Requery

If that doesn't work then you will need another strategy to fire the .br_recept_AfterUpdate event
 
Try also to comment out .Requery

If that doesn't work then you will need another strategy to fire the .br_recept_AfterUpdate event
I would like to thank you very much...it works as in your first lines with a little addition from me two lines to go to next field with .requary
 

Users who are viewing this thread

Back
Top Bottom