A Microsoft Office (Excel, Word) forum. OfficeFrustration

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   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Navigation to next record not working



 
 
Thread Tools Display Modes
  #1  
Old May 15th, 2008, 04:48 PM posted to microsoft.public.access.forms
mdullni1 via AccessMonster.com
external usenet poster
 
Posts: 5
Default Navigation to next record not working

Note: I apologize for initially posting this at tree view.

I have a form and subform. The form has a combo box that determines which
dept records to display on the subform. The subform has multiple pages of
controls for editing. This worked fine (editing, moving through records, etc)

until I added another page that has controls which rely on the value of
another control.

I have a textbox whose InputMask depends on whether a checkbox is true or
false. When I run the procedure to set the InputMask, the if checkbox test
sends the code back to form_current. I added a module-level variable that
basically flags form_current if the code is in the set InputMask procedure.
After a lot of trial and error, I got the code to set the InputMask. Now,
the problem is that when I use the built-in navigation to go to the next
record, it returns to the first record. I have walked through code and
watched ID values, the next record is accessed but the form is on the first
record.

(I also have a combobox that controls the rowsource of another combobox)

Why does the If chkbox statement invoke the form_current procedure?

Here is some code:
Private Sub Form_Current()
'************************************************* ****************************
'* Sub: Form_Current
*
'* Purpose: Sets backcolor on fields for current record. Sets Current Record
*
'* label to name of current student.
*
'************************************************* ****************************
If mblnEmrgPhn_Mask_Set = False And mblnCnty_RowSrc_Set = False Then

Me.lblCrntRcrd.Caption = "Current Record: " & Me.LNm & ", " & Me.FNm & "
" & Me.MNm

mblntabPrsnl_Set = False
mblntabCtzn_Set = False
mblntabAddr_Set = False
mblntabSchl_Set = False
mblntabSOMRqrd_Set = False
If Me!TabCtlGradAdms.Pages(Me!TabCtlGradAdms.value).N ame = "tabPrsnl"
Then
Call TabCtlGradAdms_Change
Else
Me.TabCtlGradAdms.Pages(0).SetFocus
End If

End If
End Sub

Private Sub TabCtlGradAdms_Change()
'************************************************* ****************************
'* Sub: TabCtlGradAdms_Change
*
'* Purpose: Set the display as each page of the tab gets focus.
*
'************************************************* ****************************
Call Set_BckGrnd(True)

Select Case Me!TabCtlGradAdms.Pages(Me!TabCtlGradAdms.value).N ame
Case "tabPrsnl"
If mblntabPrsnl_Set = False Then
mblntabPrsnl_Set = True
Call Set_BckGrnd_Color_Lngth(Me.txtLNm, mlngLNm_Lngth, False)
Call Set_BckGrnd_Color_Lngth(Me.txtFNm, mlngFNm_Lngth, False)
Call Set_BckGrnd_Color_Lngth(Me.txtMNm, mlngMNm_Lngth, True)
Call Set_BckGrnd_Color_Lngth(Me.txtSSN, mlngSSN_Lngth, False)

Me.txtDOB.SetFocus
Call Set_BckGrnd_Color_DOB(Me.txtDOB.Text)
Me.txtLNm.SetFocus
End If

Case "tabCtzn"
If mblntabCtzn_Set = False Then
mblntabCtzn_Set = True
Call Set_BckGrnd_Color_Visa
Me.cboStID_POB.SetFocus
End If

Case "tabAddr"
If mblntabAddr_Set = False Then
mblntabAddr_Set = True
Call Set_BckGrnd_Color_Lngth(Me.txtLclAddr1, mlngAddr1_Lngth, True)
Call Set_BckGrnd_Color_Lngth(Me.txtLclAddr2, mlngAddr2_Lngth, True)
Call Set_BckGrnd_Color_Lngth(Me.txtLclAddrCty, mlngCty_Lngth, True)
Call Set_BckGrnd_Color_Lngth(Me.txtLclAddrPstl, mlngPstl_Lngth, True)
Call Set_BckGrnd_Color_Lngth(Me.txtPrmAddr1, mlngAddr1_Lngth, True)
Call Set_BckGrnd_Color_Lngth(Me.txtPrmAddr2, mlngAddr2_Lngth, True)
Call Set_BckGrnd_Color_Lngth(Me.txtPrmAddrCty, mlngCty_Lngth, True)
Call Set_BckGrnd_Color_Lngth(Me.txtPrmAddrPstl, mlngPstl_Lngth, True)
Me.txtLclAddr1.SetFocus
End If

Case "tabSchl"
If mblntabSchl_Set = False Then
mblntabSchl_Set = True
Call Set_BckGrnd_Color_Schl(1)
Call Set_BckGrnd_Color_Schl(2)
Call Set_BckGrnd_Color_Schl(3)
Me.cboSchlID_Schl1.SetFocus
End If

Case "tabSOMRqrd"
Call Set_BckGrnd(False)
If mblntabSOMRqrd_Set = False Then
mblntabSOMRqrd_Set = True
Call Set_EmrgPhn_Mask
Call Set_Cnty_RowSrc
Me.cboJHUBldgs.SetFocus
End If

End Select

End Sub

Private Sub Set_EmrgPhn_Mask()
mblnEmrgPhn_Mask_Set = True
If Me!chkEmrgCntctIntl.value = True Then
Me!txtEmrgCntctPhn.InputMask = ""
Else
Me!txtEmrgCntctPhn.InputMask = "(999) 000-0000;;_"
End If
mblnEmrgPhn_Mask_Set = False
End Sub

Private Sub Set_Cnty_RowSrc()
mblnCnty_RowSrc_Set = True
Me.cboRSDCnty.RowSource = "select lngCntyID, strCntyDsc from tblCnty " _
& "where lngStID = " & Nz(Me!cboRSDStID, 0) & " order
by strCntyDsc"
mblnCnty_RowSrc_Set = False

End Sub

Any suggestions will be greatly appreciated.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200805/1

 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:21 AM.


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