I am trying to track down why I am getting the error intermittently.
The 2 spots that the degger show are highlighted in the code.
This DB was inherited with my new job!
Table:
TrackingTable
Columns:
Tracking_ID / PK
BoxNumber / text
FileNumber / text
TrackingDate / Date/Time
The entry for is a simple Wizard created 3 field scrolling entry form.
The application has no modules. All VBA is within the FORM.
Thanks
John Fuhrman
The 2 spots that the degger show are highlighted in the code.
This DB was inherited with my new job!
Table:
TrackingTable
Columns:
Tracking_ID / PK
BoxNumber / text
FileNumber / text
TrackingDate / Date/Time
The entry for is a simple Wizard created 3 field scrolling entry form.
The application has no modules. All VBA is within the FORM.
Code:
Option Compare Database
Option Explicit
Private Sub Text4_DblClick(Cancel As Integer)
End Sub
Private Sub BoxNumber_AfterUpdate()
Me.BoxNumber.DefaultValue = """" & Me.BoxNumber & """"
End Sub
Private Sub FileNumber_Enter():
[highlight]TrackingDate = Now()[/highlight]
'If Not Me.NewRecord Then - not working, redundant, adding to current not next box number
'Me.BoxNumber = "Me.BoxNumber.DefaultValue"
'End If
'strBoxTemp = "Me.BoxNumber"
'Dim strBoxTemp As String
'Me.BoxNumber = strBoxTemp
'FileNumber.SetFocus - after get tracking number to save & post uncomment this if nec
'strBoxTemp = "Me.BoxNumber" moves current box number to temp in after update box
'Me.BoxNumber.DefaultValue = "strBoxTemp"
'Me.BoxNumber = "strBoxTemp" moves literal 'strBoxTemp' into current box number field
'Me.BoxNumber = strBoxTemp - gets error, can't be zero length string TrackingTable.BoxNumber
'Me.BoxNumber = strBoxTemp
End Sub
Private Sub FileNumber_Exit(Cancel As Integer)
'TrackingDate = Now()
'DoCmd.GoToRecord , , acNewRec
'FileNumber.SetFocus
End Sub
Private Sub Form_Load():
DoCmd.GoToRecord , , acNewRec
BoxNumber.SetFocus
[highlight]TrackingDate = Now()[/highlight]
End Sub
Private Sub NewTrackingNumber_Click()
On Error GoTo Err_NewTrackingNumber_Click
Dim EnvString, Indx, Msg, envLen ' Declare variables.
'DoCmd.Close acForm, , acSaveYes
'move something to file number here
FileNumber = ".box.end."
DoCmd.OpenForm "TrackingTable", acNormal
DoCmd.GoToRecord , , acNewRec
BoxNumber.SetFocus
Exit_NewTrackingNumber_Click:
Exit Sub
Err_NewTrackingNumber_Click:
MsgBox Err.Description
Resume Exit_NewTrackingNumber_Click
End Sub
Private Sub PreviousTrackingNumber_Click()
On Error GoTo Err_PreviousTrackingNumber_Click
DoCmd.GoToRecord , , acPrevious
Exit_PreviousTrackingNumber_Click:
Exit Sub
Err_PreviousTrackingNumber_Click:
MsgBox Err.Description
Resume Exit_PreviousTrackingNumber_Click
End Sub
Private Sub Print_Click()
On Error GoTo Err_Print_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = "TrackingTable1"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False
Exit_Print_Click:
Exit Sub
Err_Print_Click:
MsgBox Err.Description
Resume Exit_Print_Click
End Sub
Private Sub Close_Form_Click()
On Error GoTo Err_Close_Form_Click
DoCmd.Close
Exit_Close_Form_Click:
Exit Sub
Err_Close_Form_Click:
MsgBox Err.Description
Resume Exit_Close_Form_Click
End Sub
Thanks
John Fuhrman