Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: Assignment to Constant

Status
Not open for further replies.

IagreeOK

Programmer
Mar 11, 2001
3
US
'This is declared at the module level (Declarations)
Global Const Mytable = vbRSTypeTable

'This is my Sub_Main and it is in the same module

Dim Wheresitat$
'***Get where the databases are*******
Wheresitat = app.Path & "\OnABC.Mdb"
Set PayDB = OpenDatabase(Wheresitat$, False)
Set Mytable = PayDB.OpenRecordset("FilesAreAt")
Mytable.MoveFirst
DBSAreAt$ = Mytable("FilesAreAt")

Question: I run this and get
Compile error:
Assignment to constant Not permitted When it sets
MyTable.

Can someone please explain to me why? Thank You sooo much
 
Wheresitat = app.Path & "\OnABC.Mdb"
Set PayDB = OpenDatabase(Wheresitat$, False)
Set Mytable = PayDB.OpenRecordset("FilesAreAt")
Mytable.MoveFirst
DBSAreAt$ = Mytable("FilesAreAt")

Its DAO :

its easay to declare as Option Explicit then
Dim Wheresitat$

So Dim Wheresitat As String

<Wheresitat = app.Path & &quot;\OnABC.Mdb&quot;
<Set PayDB = OpenDatabase(Wheresitat$, False)
change it to :

Wheresitat = app.Path & &quot;\OnABC.Mdb&quot;
Set PayDB = OpenDatabase(Wheresitat, False,False)

<Set Mytable = PayDB.OpenRecordset(&quot;FilesAreAt&quot;)

change it to :

Set Mytable = PayDB.OpenRecordset(&quot;FilesAreAt&quot;,DBOpenDynaset)




Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top