ms access - Operation Not Supported on Linked Table -


when function below executes '.append fld' produces error 3057. suspect qualified name needed method escaping me. sub calling function passing way of strtablename "tbl_elements" should not enough function.

i have tried fitting bit of code has reached linked table.

currentdb.execute "alter table [" & currentdb.tabledefs(strimportholdingtable).connect & "].[" & strimportholdingtable & "] drop column romis_tran_id;" 

function in question below

public function createautonumberfield(byval strtablename string, byval strfieldname string) boolean  on error goto err_createautonumberfield      dim db dao.database     dim fld dao.field     dim tdef dao.tabledef      set db = application.currentdb     set tdef = db.tabledefs(strtablename)     set fld = tdef.createfield(strfieldname, dblong)     fld         .attributes = .attributes or dbautoincrfield     end     tdef.fields         .append fld         .refresh     end      createautonumberfield = true  exit_createautonumberfield:      set fld = nothing     set tdef = nothing     set db = nothing     exit function  err_createautonumberfield:      createautonumberfield = false     err         msgbox "error " & .number & vbcrlf & .description, vbokonly or vbcritical, "createautonumberfield"     end     resume exit_createautonumberfield  end function 

with of hansup resolved issue of modifying linked table. new problem autonumber field not resetting 1 without compact , repair end can not during working hours.

public function resetautonumber(byval strtablename string, byval strfieldname string, byval strindexname string) boolean on error goto errtrap  dim db dao.database dim fld dao.field dim tdef dao.tabledef dim strdbpath string  strdbpath = mid(currentdb.tabledefs(strtablename).connect, 11)  set db = dbengine.opendatabase(strdbpath) set tdef = db.tabledefs(strtablename) set fld = tdef.createfield(strfieldname, dblong) set ind = tdef.createindex(strindexname)  'clear table db.execute "delete * " & strtablename 'delete index tdef.indexes.delete strindexname 'delete field tdef.fields.delete strfieldname 're-create field     fld         .attributes = .attributes or dbautoincrfield         .ordinalposition = 0     end     tdef.fields         .append fld         .refresh     end 'recreate index ind.fields.append ind.createfield(strindexname) tdef.indexes.append ind  set ind = nothing set fld = nothing set tdef = nothing set db = nothing  exithere: exit function errtrap: msgbox err.description resume exithere  end function 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -