Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run time error:This action was Cancelled by an associated Object

Status
Not open for further replies.

travismallen

Programmer
Aug 5, 2003
15
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top