Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to use a constant (Access 2000)

    How can i replace the number with a constant?

    In the function shown below i want to replace the number 4 with the constant MyDefault.


    Public Function CleanFields()
    Dim Sz As String
    '*******************************************
    Sz = " UPDATE tblClients SET afid = 4 "
    '*******************************************
    CurrentDb.Execute Sz
    End Function


    When i tried to replace the number 4 with the constant MyDefault i received an error
    to few parameters




    Public Const MyDefault As Integer = 4
    Public Function CleanFields()
    Dim Sz As String
    '*******************************************
    Sz = " UPDATE tblClients SET afid = MyDfeualt "
    '*******************************************
    CurrentDb.Execute Sz
    End Function

    Wht do i receive the error? How can i use a constant in my function?

  2. #2
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to use a constant (Access 2000)

    Try:
    <font face="Georgia">
    Sz = " UPDATE tblClients SET afid = " & MyDefault
    </font face=georgia>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •