close form.. add a delay or close after event

antonyx

Arsenal Supporter
Local time
Today, 12:56
Joined
Jan 7, 2005
Messages
556
Code:
Forms!Job!qbook.Value = newid
Forms("job").SetFocus
[b]here[/b]
DoCmd.Close acForm, "bookperson"

i want to either close the form ONLY when the new value has been transferred to the other form.. or close the form after 3 seconds or something because at the moment its not letting me close the form while the event is being processed..


anyone??
 
ok let me try
 
tried this and gettin same prob

Code:
Private Sub cbophone2_LostFocus()
Dim bkid
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
bkid = newid.Value
Forms!Job!qbook = bkid
Forms("job").SetFocus
Forms!Job!qpax.SetFocus
DoCmd.Close acForm, "bookperson"
End Sub
 
Maybe try DoCmd.RunCommand acCmdSaveRecord

And maybe don't set the focus as when bookperson closes the focus moves
 
still gettin the prob with this..
Code:
Private Sub cbophone2_LostFocus()
Dim bkid
DoCmd.RunCommand acCmdSaveRecord
bkid = newid.Value
Forms!Job!qbook = bkid
DoCmd.Close acForm, "bookperson"
End Sub
 
let me try.. yes the job form is open.. one sec
 
after update doesnt have the same effect because i want the action to happen when the users tabs off the cbophone2 control..

when i tab away using after update.. nothing happens.. this is because the cbophone2 control wont always be updated.. it is mostly tabbed str8 past
 
ok.. let me explain how it works.. the job form will open when the db opens..

tab from the job ref.. then enter any date.. then tab.. enter a time.. then tab again to the box with a 0 next to booker.. then tab again and the booker form should open..

you first search through the results.. (which there arent any i dont think)

so enter any old name in the first search box.. tab throught the little box next to the search and tab through the person name leaving it blank.. the new record should then be created.

then tab through the 2 phone numbers and after the second one you get the prob..

i hope you got that
 

Attachments

Put a stop in the code below this line "bkid = newid.Value" then when it runs use Ctl+Break and debug whats the value of bkid or newID

I'm going of line in a min as too tied to be of much help but will wait 5 and look at the db tomorrow morning before work that is if somebody else can't solve it in the mean time.

mick
 
Got it to work once but getting an error I'll look more tomorrow As I am missing it at the min sorry
 
have you sorted this

Code:
Forms!Job!qbook.Value = newid
Forms("job").SetFocus

[COLOR="Red"]while isopen("job")
    do events
wend[/COLOR]

DoCmd.Close acForm, "bookperson"

the red function waits for the job form to close before continuing - ie an indeterminate delay! the doevents allows access to carry on working

Now - you also need an isopen function

Code:
Function IsOpen(strName As String, Optional objtype As Integer = acForm)
     IsOpen = (SysCmd(acSysCmdGetObjectState, objtype, strName) <> 0)
End Function
 
That locked it up.

I'm off now but if it still aint been sorted I'll have a look tomorrow cant undertand why access is saying it's still processing an event?.
 
gemma have you looked at the db i posted??
 
Im Getting error 2585 And disabled most of the code except the code that checks for a search value and updates the bound control and still getting an error?????
 

Users who are viewing this thread

Back
Top Bottom