If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Lost focus/Calculating... is breaking code

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-11-12, 17:26
Foskbou Foskbou is offline
Registered User
 
Join Date: Jun 2010
Posts: 109
Lost focus/Calculating... is breaking code

I am directing my users off a subform after a single entry is made. Most of my database is designed like this and keeps integrity in the data.
My s/f has 1 hidden control + 8 data controls - 4 are tab stops

Entering and tabbing through the controls is fast and easy, but when you tab out of the last control - it loses focus for a long time and shows calculating on the bottom left. When that stops you can click back in the last control and tab again, but then it's triggering If lngID = -2147483648# Then
MsgBox "Cannot find this Account!", vbCritical, "Help!"
and the m/f and s/f go blank

What I need to do is exit the s/f and save the data, then open a pop-up for the user to choose what they are going to do next.
How do I exit the s/f automatically saving the data and getting into my pop-up?
Why is the s/f calculating so long and losing focus?


m/f code:
Private Sub Form_Load()
Forms!MoveAcctSTATREG!MOVEREG.SetFocus

End Sub

Private Sub ACCOUNT_GotFocus()
DoCmd.OpenForm , acNormal, "UPDATECHOOSER3"
End Sub


s/f code:
Private Sub Form_Current()

Dim lngID As Long

On Error GoTo Err_Form_Current

lngID = Nz(DMax("ID", "REGSTAT32511", "ACCOUNT = '" & Me.ACCOUNT.Value & "'"), -2147483648#)

If lngID = -2147483648# Then
MsgBox "Cannot find this Account!", vbCritical, "Help!"

Else

Me.STATLU.Value = DLookup("STATLU", "REGSTAT32511", "ID=" & lngID)

End If

Exit Sub

Err_Form_Current:
MsgBox "An error has occured: " & vbCrLf & Err.Number & " - " & Err.Description, vbCritical, "Something needs fixing"


End Sub










Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec


End Sub





Private Sub RNOTES_Exit(Cancel As Integer)
Me.Parent!ID.SetFocus
End Sub



pop-up code:
Private Sub MACNext_Click()
DoCmd.Close acForm, "UPDATECHOOSER3"
DoCmd.Close acForm, "MoveAcctSTATREG"
DoCmd.OpenForm "MoveAccount2211"

Exit_MACNext_Click:
Exit Sub

Err_MACNext_Click:
MsgBox Err.Description
Resume Exit_MACNext_Click

End Sub



Private Sub btnCXMAC_Click()
DoCmd.Close acForm, "UPDATECHOOSER3"
DoCmd.Close acForm, "MoveAcctSTATREG"
End Sub
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On