Oh, now I see what was meant by "you didn't copy." :-)
cut/paste from the form's module:
Public MtablenameFrom, MtablenameTo, MtablenameWorkingCopy As String
but the values don't get set until the Form_Current() runs:
MtablenameFrom = Me.ImportFilename
MtablenameTo = MtablenameFrom & "a"
ImportFilename is a field on the form where I enter the table I'm working
with.
Then, I have these actions on the ImportFilename field:
Private Sub ImportFilename_AfterUpdate()
Me.ImportFilename = UCase(Me.ImportFilename)
MtablenameTo = Me.ImportFilename & "a"
MtablenameWorkingCopy = MtablenameTo & "-working copy"
End Sub
Private Sub ImportFilename_BeforeUpdate(Cancel As Integer)
MtablenameFrom = Me.ImportFilename
End Sub
Then, I have this fragment as part of the code that runs when I click on a
command button on the form:
If fExistTable(MtablenameTo) Then
DoCmd.DeleteObject acTable, MtablenameTo
End If
And that is where I get the ByRef error.
--Bill
"Dirk Goldgar" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> "Bill H." <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> But I did just copy and paste to here.
>>
>> I don't get it either. That same function code worked in another
>> database and I just copied/pasted from that program into this new
>> program.
>
> You may have pasted the function definition, but I find it hard to believe
> that you pasted this line:
>
>>>> dim MtablenameTo as string
>
> If you had actually entered that line in a module -- and it had been
> understood -- then the words "dim", "as", and "string" would all have had
> their first letters capitalized.
>
> So if you really did copy and paste that line, something is seriously
> wrong. Please post the entire procedure containing that line.
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>