How can i eliminate the error (1 Viewer)

Bhaskara123

Registered User.
Local time
Today, 20:57
Joined
Mar 26, 2007
Messages
11
Hi all,

i am new to VB. when i wa tested one report. I got one error that is: Run time error '3126': Invalid bracketing of name '[Forms!Main!FromDate]'.

Code:

FileOut = FixName("EMPerformance-" & Format(Forms!Main!FromDate.Value, "mmddyy") & "-" & Format(Forms!Main!ToDate.Value, "mmddyy") & ".xls")
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "EMPerformance", TempLoc & FileOut, True, "Summary"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "EMPerformanceBase", TempLoc & FileOut, True, "EM Scheduled Detail"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "EMPerformanceBase-Completed", TempLoc & FileOut, True, "EM Completed Detail"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "EMPerformanceBase2-NewSR", TempLoc & FileOut, True, "EM New Detail"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "EMPerformanceBase3-Pending", TempLoc & FileOut, True, "EM Pending Detail"


Anyone can help me it would be very useful to me.
 

Dennisk

AWF VIP
Local time
Today, 15:27
Joined
Jul 22, 2004
Messages
1,649
Forms!Main!FromDate
or
[Forms]![Main]![Fromdate]
 

Bhaskara123

Registered User.
Local time
Today, 20:57
Joined
Mar 26, 2007
Messages
11
Again i got one error i.e compile error

Hi all,

I used this code:

FileOut = FixName("EMPerformance-" & Format((Forms)!(Main)!(FromDate.Value), "mmddyy") & "-" & Format(Forms!Main!ToDate.Value, "mmddyy") & ".xls")

i got error like Compile error: Expected: list seperator or )

where should i put the brackets exactly?

Anyone can you please help me. It would be very useful to me.

Thanks,
Bhaskar.
 

Bhaskara123

Registered User.
Local time
Today, 20:57
Joined
Mar 26, 2007
Messages
11
How to eliminate the syntax error

Hi all,

I used this code:

FileOut = FixName("EMPerformance-" & Format((Forms)!(Main)!(FromDate.Value), "mmddyy") & "-" & Format(Forms!Main!ToDate.Value, "mmddyy") & ".xls")

i got error like Compile error: Expected: list seperator or )

where should i put the brackets exactly?

Anyone can you please help me. It would be very useful to me.

Thanks,
Bhaskar.
 

boblarson

Smeghead
Local time
Today, 08:27
Joined
Jan 12, 2001
Messages
32,059
FileOut = FixName("EMPerformance-" & Format(Forms!Main!FromDate, "mmddyy") & "-" & Format(Forms!Main!ToDate, "mmddyy") & ".xls")
 

Bhaskara123

Registered User.
Local time
Today, 20:57
Joined
Mar 26, 2007
Messages
11
Again i got one error

Hi Boblarson,

I got one error that is: Run time error '3126': Invalid bracketing of name '[Forms!Main!FromDate]'.

Can you please give me the solution

Thanks,
Bhaskar.
 

boblarson

Smeghead
Local time
Today, 08:27
Joined
Jan 12, 2001
Messages
32,059
Take away the brackets

Forms!Main!FromDate
 

Bhaskara123

Registered User.
Local time
Today, 20:57
Joined
Mar 26, 2007
Messages
11
Again i got error

Hi Boblarson,

Again i got error like Compile error: Expected: list seperator or )

Code:

FileOut = FixName("EMPerformance-" & Format Forms!Main!FromDate.Value, "mmddyy" & "-" & Format(Forms!Main!ToDate.Value, "mmddyy") & ".xls")

Can you please give me the solution

Thanks,
Bhaskar.
 
Last edited:

lution

Registered User.
Local time
Today, 10:27
Joined
Mar 21, 2007
Messages
114
You missed a set of ( ) that Bob included in his previous reply

FileOut = FixName("EMPerformance-" & Format(Forms!Main!FromDate, "mmddyy") & "-" & Format(Forms!Main!ToDate, "mmddyy") & ".xls")

I've made them red for emphasis. When you use the Format function you need to include the parameters to the function within ( ).

-Lution
 

Users who are viewing this thread

Top Bottom