[AccessD] invalid number of arguments

Pedro Janssen pedro at plex.nl
Tue Jun 14 16:30:19 CDT 2005


Hello Neal,

WQhen using:

""Function DeleteTableLink() as Boolean

Then you would need to specify which table in the function like this

db.TableDefs.Delete "tblDebiteurAlgemeen"       ""


It  not only removes the link, but also deletes the table.

What i would like is to remove the link, so that the table can be used.

Can you explain, where and how to use:  DeleteTableLink
"tblDebiteurAlgemeen" in the code.
Maybe i misunderstand what you mean because when using this after Function,
i get Compiling errors, because the code expects instruction ends.



Let me explain a little more why i need to delete the link:
I have a linked table.
I need a copy of that table (structure and data) , without the copy is
beeing linked to.
After that i need to adjust, by code some field names.

Who has done this before and can help me with this??

Pedro Janssen



----- Original Message -----
From: "Neal Kling" <nkling at co.montgomery.ny.us>
To: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
Sent: Monday, June 13, 2005 9:49 PM
Subject: RE: [AccessD] invalid number of arguments


> Pedro,
>
> This line
>
> Function DeleteTableLink(tblDebiteurAlgemeen As String) As Boolean
>
> is telling the function that it is going to expect you to pass it a string
parameter of the name of the table you want to delete.
>
> Where you are calling the function it would have to done like this:
> DeleteTableLink "tblDebiteurAlgemeen"
>
> That way the function knows which table to delete. If this is causing you
too many problems you can get rid of the requirement for that parameter and
declare the function like this:
>
> Function DeleteTableLink() as Boolean
>
> Then you would need to specify which table in the function like this
>
> db.TableDefs.Delete "tblDebiteurAlgemeen"
>
> The problem is now you have a function that will only do one thing. It
won't be reusable.
>
> Neal
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Pedro Janssen
> Sent: Monday, June 13, 2005 3:15 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] invalid number of arguments
>
>
> Hello Neal,
>
> i now have tried:
>
> Function DeleteTableLink(tblDebiteurAlgemeen As String) As Boolean
> On Error GoTo Err_DeleteTableLink
>   Dim db As Database
>
>   Set db = DBEngine(0)(0)
>   db.TableDefs.Delete (tblDebiteurAlgemeen)
>   db.TableDefs.Refresh
>
>   DeleteTableLink = True
>
> Exit_DeleteTableLink:
>
> etc.etc.etc
>
>
> but i still have the error.
>
> Anyone any ideas.
>
> Pedro
>
>
>
> ----- Original Message -----
> From: "Neal Kling" <nkling at co.montgomery.ny.us>
> To: "Access Developers discussion and problem solving"
> <accessd at databaseadvisors.com>
> Sent: Monday, June 13, 2005 2:52 PM
> Subject: RE: [AccessD] invalid number of arguments
>
>
> > I see you're setting the table variable right in the function. But the
> function it's self is still expecting you to pass a table name. I suspect
> this may be where you are having a problem. Either redeclare the function
> without the strTableName parameter, or pass it the table name. In other
> words instead of setting strTableName in the function, call the function
> like this:
> >
> > DeleteTableLink "tblDebiteurAlgemeen"
> >
> > Don't forget to comment out the line
> > strTableName = "tblDebiteurAlgemeen"
> >
> > Neal
> >
> > -----Original Message-----
> > From: accessd-bounces at databaseadvisors.com
> > [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Pedro Janssen
> > Sent: Sunday, June 12, 2005 5:51 PM
> > To: AccessD at databaseadvisors.com
> > Subject: [AccessD] invalid number of arguments
> >
> >
> > Hello Group,
> >
> > i am using a function that Neil Kling provided me in the past.
> > When running it from an expression i get an error:
> >
> > Invalid number of arguments.
> >
> > Who can help me with this
> >
> > Pedro Janssen
> >
> >
> >
> >
> > Function DeleteTableLink(strTableName As String) As Boolean
> > On Error GoTo Err_DeleteTableLink
> >   Dim db As Database
> >
> >   strTableName = "tblDebiteurAlgemeen"
> >
> >   Set db = DBEngine(0)(0)
> >   db.TableDefs.Delete strTableName
> >   db.TableDefs.Refresh
> >
> >   DeleteTableLink = True
> >
> > Exit_DeleteTableLink:
> > Exit Function
> >
> > Err_DeleteTableLink:
> >   Select Case Err
> >   Case 0    'insert Errors you wish to ignore here
> >     Resume Next
> >   Case 3265      'Item doesn't exist in collection
> >         Resume Next
> >   Case Else 'All other errors will trap
> >     Beep
> >     MsgBox Err.Number & "; " & Err.Description, , "Error in function
> basObjectHandlers.DeleteTableLink"
> >   Resume Exit_DeleteTableLink
> >   End Select
> >   Resume 0  'FOR TROUBLESHOOTING
> > End Function
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>






More information about the AccessD mailing list