travismallen
Programmer
Im trying to create a program that assigns a location after checking to see if it's used already, but I get this error compiling...
Run Time error '3426':
This action was Cancelled by an associated Object
Here is the code, the bold part is where the compiler gets stuck
'--------------------------------------------------------
Private Sub locGen_Click()
Dim Counter
Dim Check
Dim TempLoc As String
Dim rst As DAO.Recordset
Set rst = Me.Recordset
Counter = 0
Check = True
'Loop that terminates if location is available
Do While Check = True
'Holds location and changes if the location is used via the counter
TempLoc = "Subject." & Str(Trim(Counter))
'Checks if Location is used
rst.FindFirst "Location = " & TempLoc this is where the error occurs
If rst.NoMatch Then
Check = False
Else
Counter = Counter + 1
End If
Loop
rst.Close
'Sets location
Me.Location = TempLoc
End Sub
Thanks,
Travis
___________________________
"I am what I am" - Popeye
Travis M. Allen
Run Time error '3426':
This action was Cancelled by an associated Object
Here is the code, the bold part is where the compiler gets stuck
'--------------------------------------------------------
Private Sub locGen_Click()
Dim Counter
Dim Check
Dim TempLoc As String
Dim rst As DAO.Recordset
Set rst = Me.Recordset
Counter = 0
Check = True
'Loop that terminates if location is available
Do While Check = True
'Holds location and changes if the location is used via the counter
TempLoc = "Subject." & Str(Trim(Counter))
'Checks if Location is used
rst.FindFirst "Location = " & TempLoc this is where the error occurs
If rst.NoMatch Then
Check = False
Else
Counter = Counter + 1
End If
Loop
rst.Close
'Sets location
Me.Location = TempLoc
End Sub
Thanks,
Travis
___________________________
"I am what I am" - Popeye
Travis M. Allen