First, please be a bit patient with me as I am picking Access/VBA back up after not doing it for seven or so years. It's amazing what you can pickup immediately and what has to be drawn from the depths.
That being said here is my issue:
I am trying to change field names in a table, but I don't know if my code is right because I can't get it to run!
Here is the code:
Private Sub Command8_Click()
DoCmd.OpenQuery "qryUsageTotals2", acViewNormal, acReadOnly
DoCmd.DeleteObject acTable, "tblInventory"
DoCmd.Rename "tblInventory", acTable, "tblInventoryTest"
Public Function chgfldnm()
End Function
End Sub
Public Function chgfldnm(Qty As String, QtyTest As String)
Dim db As Database
Dim tbf As TableDef
Dim n As Object
Set db = CurrentDb
Set tbf = TableDefs("tblInventory")
For Each n In tdf.Fields
If n.Name = QtyTest Then n.Name = Qty
Next n
Set tdf = Nothing
Set db = Nothing
End Function
End Function
When I try to run or compile I get:
Compile Error:
Ambiguous name detected:chgfldnm
I have searched the net for four hours trying to find an answer. Please Help!!!!!