sousabeast
Programmer
I'm using Access 2007 for the first time and I have made a form for my datasheet. However, the user needs the ability to add columns in the form. I have worked out the VBA code and the only thing standing in my way is that I can't end the command button control proccess/module or anything like that. Here is my code
Public Sub addfield()
DoCmd.Close acTable, "Non HAPS", acSaveYes
DoCmd.Close acForm, "Non HAPS", acSaveYes
DoCmd.Close acModule, "Add New Non HAP", acSaveYes
Dim curDatabase As Object
Dim tblNon_HAPS As Object
Dim colz As Field
Dim z As String
Set curDatabase = CurrentDb
Set tblNon_HAPS = curDatabase.TableDefs("Non HAPS")
z = InputBox("Enter New Non HAP Name")
Set colz = tblNon_HAPS.CreateField(z, dbText)
tblNon_HAPS.Fields.Append colz
End Sub
This sub is referenced by the form commandbutton private sub. So when I click my commandbutton I get an error saying that the database could not lock engine because it is in use by another person or project.
Is there anyway I can end the commanbutton private sub without being in it?
Public Sub addfield()
DoCmd.Close acTable, "Non HAPS", acSaveYes
DoCmd.Close acForm, "Non HAPS", acSaveYes
DoCmd.Close acModule, "Add New Non HAP", acSaveYes
Dim curDatabase As Object
Dim tblNon_HAPS As Object
Dim colz As Field
Dim z As String
Set curDatabase = CurrentDb
Set tblNon_HAPS = curDatabase.TableDefs("Non HAPS")
z = InputBox("Enter New Non HAP Name")
Set colz = tblNon_HAPS.CreateField(z, dbText)
tblNon_HAPS.Fields.Append colz
End Sub
This sub is referenced by the form commandbutton private sub. So when I click my commandbutton I get an error saying that the database could not lock engine because it is in use by another person or project.
Is there anyway I can end the commanbutton private sub without being in it?