More Correct Syntax

D

DS

Once again REDACT() is a function pointing to the external database.
Is this syntax correct?
Thanks
DS

Set dbs = REDACT()
Set rst = dbs.OpenRecordset("SELECT * FROM tblChecksTMP IN '" & REDACT() &
"' WHERE tblChecksTMP.ChkOldCheckID = " &
Forms!frmPadDivider!TxtDPOldSalesID & "", dbOpenDynaset)

With rst
Do Until .EOF
For i = 1 To Me.TxtDivideCheck
portion(i) = myNumDivByX
.Edit
!ChkTotal = portion(i) & vbCrLf
.Update
.MoveNext
Next i
Loop
End With
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing
 
S

Stefan Hoffmann

hi,
Once again REDACT() is a function pointing to the external database.
Is this syntax correct?
No, but i had to mad some assumptions.
Set dbs = REDACT()
Normal naming conventions indicate that dbs is declared as

Dim dbs As DAO.Datbase

or

Dim dbs As Database

This means, that REDACT() is somewhere declared as

Function/Propert Get REDACT() As DAO.Database

Is this true? When yes, then you can't use it here:
Set rst = dbs.OpenRecordset("SELECT * FROM tblChecksTMP IN '" & REDACT() &
"' WHERE tblChecksTMP.ChkOldCheckID = " &
Forms!frmPadDivider!TxtDPOldSalesID & "", dbOpenDynaset)
Because you need a string specifying a database. Changing it to

"...tblChecksTMP IN '" & REDACT().Name & "..."

may work.


mfG
--> stefan <--
 
D

DS

Could I just use...
Set dbs = Opendatabase("REDACT()")
for the first part?
Thanks
DS
 
S

Stefan Hoffmann

hi,
Could I just use...
Set dbs = Opendatabase("REDACT()")
for the first part?
Not sure, where is REDACT() declared. And what is it?

When it returns a string containing the name and path to a database,
then yes, you can.


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top