goto new record when all fields filled in

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form w/ 3 bound fields and 1 unbound. We use scan guns to enter
barcodes into access. all scanning in done in the unbound field and based on
a prefix the data is moved to the correct bound field - no problem. When all
3 bound fields are filled in i want to move to a new record and start over
again. Any help on this part? I was toying with using MATH to update a
"value" and a case statment to evaluate the "value" and go to a newrecord
from there, but it doesn't work.
here is the code i have now in the afterupdate event of the unbound field.

Private Sub Text14_AfterUpdate()
Dim I
Dim scan As Variant
Dim check As Integer

Select Case check
Case Is = 1
GoTo inputloop
Case Is = 2
GoTo inputloop
Case Is = 3
DoCmd.GoToRecord , , acNewRec
End Select

inputloop:
Me.Text14.SetFocus
scan = Left$(Forms!CopyofFRM_SLABack.Text14, 2)
Select Case scan
Case Is = "DH"
If IsNull(Me.PSSN) Then
Me.PSSN = Me.Text14
check = check + 1
Else
Me.Text14.SetFocus
'Beep 280, 280
End If
Case Is = "BB"
If IsNull(Me.SLABack) Then
Me.SLABack = Me.Text14
check = check + 1
Else
Me.Text14.SetFocus
'Beep 280, 280
End If
Case Is = "AC"
If IsNull(Me.MBSN) Then
Me.MBSN = Me.Text14
check = check + 1
Else
Me.Text14.SetFocus
'Beep 280, 280
End If
Case Else
Me.Text14.SetFocus
For I = 1 To 3
'Beep 100, 100
Me.Text14.SetFocus
Next I
End Select

Me.Text14.Value = ""

End Sub
 
I'm not sure I quite understand what you are getting at but it appears that
you declare "check" in the AfterUpdate subroutine but don't assign a value to
it before referencing it in the Case statement.
 
OOPS!.
i placed Check = 0 below my dim statements and it still won't goto a
newrecord.
any other thoughts.
maybe this will provide better understanding. The "inputloop" section
below, is no problem, it places the scanned data into the correct field and
won't allow you to enter data into that field again. I have some beeps going
on for audible notification only. once all 3 fields have data i want to save
this record and move to anew one and start the process over again. So, i was
thinking of ADDING 1 to "check" for each of the 3 fields, when check = 3 do
the new record thing. this is whhere my problem lies
 
Would something like this work for you?

At the end of the AfterUpdate event, you set text14 = ""

Perhaps an If...Then statement to check if there is a value in the 3 bound
fields and if there is to go to a new record? Something like this...

If IsNull(boundText1) = False AND IsNull(boundText2) = False AND IsNull
_(boundText3) THEN
DoCmd.GoToRecord , , acNewRec
End if

 
Back
Top