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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application error closing Access

Status
Not open for further replies.

chris9

Programmer
Feb 11, 2003
32
US
I've added the following code to one of my access forms:

Dim tnm As String

'Get the table name
tnm = [Forms]![Form1]!Text0.Value

If Not CurrentDb(tnm) Then
MsgBox "This table already exists in the Database."
DoCmd.RunSQL "DELETE * FROM " & [Forms]![Form1]![Text0] & ""
DoCmd.RunSQL "ALTER TABLE " & [Forms]![Form1]![Text0] & " DROP COLUMN MakeName"
Else
End If

The form was working just fine before and this statement is running but then as it is about to finish i get an applications error that shuts down access. Does anyone have any ideas on what would be causing this if i just added this one piece of code.
I want to check to see if the table that I am about to create already existed and if it did delete it before I create the new one.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top