Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Form not unloading before next code line

Hi All,

I have a large form which l need to unload before the MsgBox asks the user
if they want to move to the next record.

The code below works but does not unload frmHR before the MsgBox appears.
Can anybody tell me whats wrong?

Regards

Michael Beckinsale


Private Sub cmbHREnter_Click()

Dim RowNo
Dim Q1

Call Unprotect
'Assign text box values to variables
Nino = tbNino.Text
Surname = tbSurname.Text
Forename1 = tbForename1.Text
Forename2 = tbForename2.Text
DOB = tbDOB.Value
DPSno = tbDPS.Value
EstCode = tbEstCode.Text
Est = tbEst.Text
Quantum = tbQuantum.Text
Email = tbEmail.Text
Grade = cbxGrade.Value
ContStaff = cbxStaff.Value
Salutation = cbxSalutation.Value
Status = cbxStatus.Value
Gender = cbxGender.Value
LineManager = cbxLineManager.Value
ContArea = cbxContractorarea.Value
Ethnic = cbxEthnicgroup.Value
'Enter variable values / text into relevant cells
ActiveCell.Offset(0, -1).Value = Nino
ActiveCell.Value = Surname
ActiveCell.Offset(0, 1).Value = Forename1
ActiveCell.Offset(0, 2).Value = Forename2
ActiveCell.Offset(0, 3).Value = DOB
ActiveCell.Offset(0, 4).Value = DPSno
ActiveCell.Offset(0, 10).Value = EstCode
ActiveCell.Offset(0, 11).Value = Est
ActiveCell.Offset(0, 12).Value = Quantum
ActiveCell.Offset(0, 13).Value = Email
ActiveCell.Offset(0, 8).Value = Grade
ActiveCell.Offset(0, 14).Value = ContStaff
ActiveCell.Offset(0, 15).Value = Salutation
ActiveCell.Offset(0, 16).Value = Status
ActiveCell.Offset(0, 17).Value = Gender
ActiveCell.Offset(0, 18).Value = LineManager
ActiveCell.Offset(0, 19).Value = ContArea
ActiveCell.Offset(0, 20).Value = Ethnic
'Highlight row in red to indicate it has been checked
ActiveCell.Offset(0, -2).Value = "Yes"
RowNo = ActiveCell.Row
Rows(RowNo).Select
Selection.Font.ColorIndex = 3
Unload frmHR
ActiveCell.Offset(0, 2).Select
'Application.Wait Now + TimeValue("00:00:05") Entered this to see if it
would unload before next code line
'Ask user if they want to move to next record or exit
Q1 = MsgBox("Do you want to move to the next record ?", vbYesNo,
"Question")
If Q1 = vbYes Then
ActiveCell.Offset(1, 0).Select
frmHR.Show
Else
Call Protect
Exit Sub
End If

Call Protect

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Form not unloading before next code line

Try adding a doevents:

Unload frmHR
doevents
ActiveCell.Offset(0, 2).Select

--
Regards,
Tom Ogilvy


"Michael Beckinsale" wrote in message
...
Hi All,

I have a large form which l need to unload before the MsgBox asks the user
if they want to move to the next record.

The code below works but does not unload frmHR before the MsgBox appears.
Can anybody tell me whats wrong?

Regards

Michael Beckinsale


Private Sub cmbHREnter_Click()

Dim RowNo
Dim Q1

Call Unprotect
'Assign text box values to variables
Nino = tbNino.Text
Surname = tbSurname.Text
Forename1 = tbForename1.Text
Forename2 = tbForename2.Text
DOB = tbDOB.Value
DPSno = tbDPS.Value
EstCode = tbEstCode.Text
Est = tbEst.Text
Quantum = tbQuantum.Text
Email = tbEmail.Text
Grade = cbxGrade.Value
ContStaff = cbxStaff.Value
Salutation = cbxSalutation.Value
Status = cbxStatus.Value
Gender = cbxGender.Value
LineManager = cbxLineManager.Value
ContArea = cbxContractorarea.Value
Ethnic = cbxEthnicgroup.Value
'Enter variable values / text into relevant cells
ActiveCell.Offset(0, -1).Value = Nino
ActiveCell.Value = Surname
ActiveCell.Offset(0, 1).Value = Forename1
ActiveCell.Offset(0, 2).Value = Forename2
ActiveCell.Offset(0, 3).Value = DOB
ActiveCell.Offset(0, 4).Value = DPSno
ActiveCell.Offset(0, 10).Value = EstCode
ActiveCell.Offset(0, 11).Value = Est
ActiveCell.Offset(0, 12).Value = Quantum
ActiveCell.Offset(0, 13).Value = Email
ActiveCell.Offset(0, 8).Value = Grade
ActiveCell.Offset(0, 14).Value = ContStaff
ActiveCell.Offset(0, 15).Value = Salutation
ActiveCell.Offset(0, 16).Value = Status
ActiveCell.Offset(0, 17).Value = Gender
ActiveCell.Offset(0, 18).Value = LineManager
ActiveCell.Offset(0, 19).Value = ContArea
ActiveCell.Offset(0, 20).Value = Ethnic
'Highlight row in red to indicate it has been checked
ActiveCell.Offset(0, -2).Value = "Yes"
RowNo = ActiveCell.Row
Rows(RowNo).Select
Selection.Font.ColorIndex = 3
Unload frmHR
ActiveCell.Offset(0, 2).Select
'Application.Wait Now + TimeValue("00:00:05") Entered this to see if it
would unload before next code line
'Ask user if they want to move to next record or exit
Q1 = MsgBox("Do you want to move to the next record ?", vbYesNo,
"Question")
If Q1 = vbYes Then
ActiveCell.Offset(1, 0).Select
frmHR.Show
Else
Call Protect
Exit Sub
End If

Call Protect

End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Form not unloading before next code line

Tom,

Thanks for the reply.

I have tried what you suggested and l still get the MsgBox before the frmHR
unloads! Any idea's please.

I am using Excel 2003 / Windows XP

Regards

Michael
"Tom Ogilvy" wrote in message
...
Try adding a doevents:

Unload frmHR
doevents
ActiveCell.Offset(0, 2).Select

--
Regards,
Tom Ogilvy


"Michael Beckinsale" wrote in message
...
Hi All,

I have a large form which l need to unload before the MsgBox asks the
user
if they want to move to the next record.

The code below works but does not unload frmHR before the MsgBox appears.
Can anybody tell me whats wrong?

Regards

Michael Beckinsale


Private Sub cmbHREnter_Click()

Dim RowNo
Dim Q1

Call Unprotect
'Assign text box values to variables
Nino = tbNino.Text
Surname = tbSurname.Text
Forename1 = tbForename1.Text
Forename2 = tbForename2.Text
DOB = tbDOB.Value
DPSno = tbDPS.Value
EstCode = tbEstCode.Text
Est = tbEst.Text
Quantum = tbQuantum.Text
Email = tbEmail.Text
Grade = cbxGrade.Value
ContStaff = cbxStaff.Value
Salutation = cbxSalutation.Value
Status = cbxStatus.Value
Gender = cbxGender.Value
LineManager = cbxLineManager.Value
ContArea = cbxContractorarea.Value
Ethnic = cbxEthnicgroup.Value
'Enter variable values / text into relevant cells
ActiveCell.Offset(0, -1).Value = Nino
ActiveCell.Value = Surname
ActiveCell.Offset(0, 1).Value = Forename1
ActiveCell.Offset(0, 2).Value = Forename2
ActiveCell.Offset(0, 3).Value = DOB
ActiveCell.Offset(0, 4).Value = DPSno
ActiveCell.Offset(0, 10).Value = EstCode
ActiveCell.Offset(0, 11).Value = Est
ActiveCell.Offset(0, 12).Value = Quantum
ActiveCell.Offset(0, 13).Value = Email
ActiveCell.Offset(0, 8).Value = Grade
ActiveCell.Offset(0, 14).Value = ContStaff
ActiveCell.Offset(0, 15).Value = Salutation
ActiveCell.Offset(0, 16).Value = Status
ActiveCell.Offset(0, 17).Value = Gender
ActiveCell.Offset(0, 18).Value = LineManager
ActiveCell.Offset(0, 19).Value = ContArea
ActiveCell.Offset(0, 20).Value = Ethnic
'Highlight row in red to indicate it has been checked
ActiveCell.Offset(0, -2).Value = "Yes"
RowNo = ActiveCell.Row
Rows(RowNo).Select
Selection.Font.ColorIndex = 3
Unload frmHR
ActiveCell.Offset(0, 2).Select
'Application.Wait Now + TimeValue("00:00:05") Entered this to see if it
would unload before next code line
'Ask user if they want to move to next record or exit
Q1 = MsgBox("Do you want to move to the next record ?", vbYesNo,
"Question")
If Q1 = vbYes Then
ActiveCell.Offset(1, 0).Select
frmHR.Show
Else
Call Protect
Exit Sub
End If

Call Protect

End Sub






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Form not unloading before next code line

Application.ScreenUpdating = True
Unload frmHR
doevents
ActiveCell.Offset(0, 2).Select

Would be an additional suggestion

--
Regards,
Tom Ogilvy



"Michael Beckinsale" wrote in message
...
Tom,

Thanks for the reply.

I have tried what you suggested and l still get the MsgBox before the

frmHR
unloads! Any idea's please.

I am using Excel 2003 / Windows XP

Regards

Michael
"Tom Ogilvy" wrote in message
...
Try adding a doevents:

Unload frmHR
doevents
ActiveCell.Offset(0, 2).Select

--
Regards,
Tom Ogilvy


"Michael Beckinsale" wrote in message
...
Hi All,

I have a large form which l need to unload before the MsgBox asks the
user
if they want to move to the next record.

The code below works but does not unload frmHR before the MsgBox

appears.
Can anybody tell me whats wrong?

Regards

Michael Beckinsale


Private Sub cmbHREnter_Click()

Dim RowNo
Dim Q1

Call Unprotect
'Assign text box values to variables
Nino = tbNino.Text
Surname = tbSurname.Text
Forename1 = tbForename1.Text
Forename2 = tbForename2.Text
DOB = tbDOB.Value
DPSno = tbDPS.Value
EstCode = tbEstCode.Text
Est = tbEst.Text
Quantum = tbQuantum.Text
Email = tbEmail.Text
Grade = cbxGrade.Value
ContStaff = cbxStaff.Value
Salutation = cbxSalutation.Value
Status = cbxStatus.Value
Gender = cbxGender.Value
LineManager = cbxLineManager.Value
ContArea = cbxContractorarea.Value
Ethnic = cbxEthnicgroup.Value
'Enter variable values / text into relevant cells
ActiveCell.Offset(0, -1).Value = Nino
ActiveCell.Value = Surname
ActiveCell.Offset(0, 1).Value = Forename1
ActiveCell.Offset(0, 2).Value = Forename2
ActiveCell.Offset(0, 3).Value = DOB
ActiveCell.Offset(0, 4).Value = DPSno
ActiveCell.Offset(0, 10).Value = EstCode
ActiveCell.Offset(0, 11).Value = Est
ActiveCell.Offset(0, 12).Value = Quantum
ActiveCell.Offset(0, 13).Value = Email
ActiveCell.Offset(0, 8).Value = Grade
ActiveCell.Offset(0, 14).Value = ContStaff
ActiveCell.Offset(0, 15).Value = Salutation
ActiveCell.Offset(0, 16).Value = Status
ActiveCell.Offset(0, 17).Value = Gender
ActiveCell.Offset(0, 18).Value = LineManager
ActiveCell.Offset(0, 19).Value = ContArea
ActiveCell.Offset(0, 20).Value = Ethnic
'Highlight row in red to indicate it has been checked
ActiveCell.Offset(0, -2).Value = "Yes"
RowNo = ActiveCell.Row
Rows(RowNo).Select
Selection.Font.ColorIndex = 3
Unload frmHR
ActiveCell.Offset(0, 2).Select
'Application.Wait Now + TimeValue("00:00:05") Entered this to see if it
would unload before next code line
'Ask user if they want to move to next record or exit
Q1 = MsgBox("Do you want to move to the next record ?", vbYesNo,
"Question")
If Q1 = vbYes Then
ActiveCell.Offset(1, 0).Select
frmHR.Show
Else
Call Protect
Exit Sub
End If

Call Protect

End Sub








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Form not unloading before next code line

Tom,

Many thanks that did it.

Its amazing how many times one overlooks the simple things !

Regards

Michael

"Tom Ogilvy" wrote in message
...
Application.ScreenUpdating = True
Unload frmHR
doevents
ActiveCell.Offset(0, 2).Select

Would be an additional suggestion

--
Regards,
Tom Ogilvy



"Michael Beckinsale" wrote in message
...
Tom,

Thanks for the reply.

I have tried what you suggested and l still get the MsgBox before the

frmHR
unloads! Any idea's please.

I am using Excel 2003 / Windows XP

Regards

Michael
"Tom Ogilvy" wrote in message
...
Try adding a doevents:

Unload frmHR
doevents
ActiveCell.Offset(0, 2).Select

--
Regards,
Tom Ogilvy


"Michael Beckinsale" wrote in message
...
Hi All,

I have a large form which l need to unload before the MsgBox asks the
user
if they want to move to the next record.

The code below works but does not unload frmHR before the MsgBox

appears.
Can anybody tell me whats wrong?

Regards

Michael Beckinsale


Private Sub cmbHREnter_Click()

Dim RowNo
Dim Q1

Call Unprotect
'Assign text box values to variables
Nino = tbNino.Text
Surname = tbSurname.Text
Forename1 = tbForename1.Text
Forename2 = tbForename2.Text
DOB = tbDOB.Value
DPSno = tbDPS.Value
EstCode = tbEstCode.Text
Est = tbEst.Text
Quantum = tbQuantum.Text
Email = tbEmail.Text
Grade = cbxGrade.Value
ContStaff = cbxStaff.Value
Salutation = cbxSalutation.Value
Status = cbxStatus.Value
Gender = cbxGender.Value
LineManager = cbxLineManager.Value
ContArea = cbxContractorarea.Value
Ethnic = cbxEthnicgroup.Value
'Enter variable values / text into relevant cells
ActiveCell.Offset(0, -1).Value = Nino
ActiveCell.Value = Surname
ActiveCell.Offset(0, 1).Value = Forename1
ActiveCell.Offset(0, 2).Value = Forename2
ActiveCell.Offset(0, 3).Value = DOB
ActiveCell.Offset(0, 4).Value = DPSno
ActiveCell.Offset(0, 10).Value = EstCode
ActiveCell.Offset(0, 11).Value = Est
ActiveCell.Offset(0, 12).Value = Quantum
ActiveCell.Offset(0, 13).Value = Email
ActiveCell.Offset(0, 8).Value = Grade
ActiveCell.Offset(0, 14).Value = ContStaff
ActiveCell.Offset(0, 15).Value = Salutation
ActiveCell.Offset(0, 16).Value = Status
ActiveCell.Offset(0, 17).Value = Gender
ActiveCell.Offset(0, 18).Value = LineManager
ActiveCell.Offset(0, 19).Value = ContArea
ActiveCell.Offset(0, 20).Value = Ethnic
'Highlight row in red to indicate it has been checked
ActiveCell.Offset(0, -2).Value = "Yes"
RowNo = ActiveCell.Row
Rows(RowNo).Select
Selection.Font.ColorIndex = 3
Unload frmHR
ActiveCell.Offset(0, 2).Select
'Application.Wait Now + TimeValue("00:00:05") Entered this to see if
it
would unload before next code line
'Ask user if they want to move to next record or exit
Q1 = MsgBox("Do you want to move to the next record ?", vbYesNo,
"Question")
If Q1 = vbYes Then
ActiveCell.Offset(1, 0).Select
frmHR.Show
Else
Call Protect
Exit Sub
End If

Call Protect

End Sub










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro code to put series name next to individual line in line grap Otani Charts and Charting in Excel 3 February 23rd 10 07:24 PM
Strange issue freezing parent form when unloading a child form Stefano Gatto Excel Programming 1 November 11th 05 04:42 PM
Unloading a form using the ESC key johncassell[_24_] Excel Programming 2 August 16th 05 06:19 PM
How to avoid re-initialisation when Unloading form count Excel Programming 4 December 14th 04 03:58 PM
Unloading A Form Chrissy[_4_] Excel Programming 1 October 15th 03 02:17 PM


All times are GMT +1. The time now is 03:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"