Screen flashes once when doing On Exit [event procedure] for updat

G

Guest

Screen flashes once when doing On Exit [event procedure] to update a value in
another form. When exiting the field the screen flashes once. The other
form is updated correctly. Why does the screen flash? Below is the code that
is used:

Private Sub TotCol_Exit(Cancel As Integer)

DoCmd.OpenForm "TemporaryVal", acNormal, "", "[Number] =" & [Testmdj],
acEdit, acNormal

Forms!TemporaryVal!TempVal = [Tempmdj]

DoCmd.Close acForm, "TemporaryVal", acSaveYes

End Sub
 
T

tina

the screen flashes because you're opening and immediately closing the other
form. i assume that form TemporaryVal is bound to a table in your database?
if so, instead of opening the form and updating a particular record, suggest
you run an Update query to change the specific record, as

CurrentDb.Execute "UPDATE NameOfTable SET TempVal = " _
& Me!Tempmdj & " WHERE [Number] = " & Me!Testmdj, _
dbFailOnError

substitute the correct name of the table, of course. also, the above code
assumes that field TempVal is a number data type. if it is text instead, use
single quotes to enclose the value, as

CurrentDb.Execute "UPDATE NameOfTable SET TempVal = '" _
& Me!Tempmdj & "' WHERE [Number] = " & Me!Testmdj, _
dbFailOnError

hth
 
G

Guest

hth

thanks! i will give it a try

jsccorps

tina said:
the screen flashes because you're opening and immediately closing the other
form. i assume that form TemporaryVal is bound to a table in your database?
if so, instead of opening the form and updating a particular record, suggest
you run an Update query to change the specific record, as

CurrentDb.Execute "UPDATE NameOfTable SET TempVal = " _
& Me!Tempmdj & " WHERE [Number] = " & Me!Testmdj, _
dbFailOnError

substitute the correct name of the table, of course. also, the above code
assumes that field TempVal is a number data type. if it is text instead, use
single quotes to enclose the value, as

CurrentDb.Execute "UPDATE NameOfTable SET TempVal = '" _
& Me!Tempmdj & "' WHERE [Number] = " & Me!Testmdj, _
dbFailOnError

hth


jsccorps said:
Screen flashes once when doing On Exit [event procedure] to update a value in
another form. When exiting the field the screen flashes once. The other
form is updated correctly. Why does the screen flash? Below is the code that
is used:

Private Sub TotCol_Exit(Cancel As Integer)

DoCmd.OpenForm "TemporaryVal", acNormal, "", "[Number] =" & [Testmdj],
acEdit, acNormal

Forms!TemporaryVal!TempVal = [Tempmdj]

DoCmd.Close acForm, "TemporaryVal", acSaveYes

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top