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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Script Issue

Status
Not open for further replies.

jalenben1

Programmer
Jul 22, 2008
154
US
I wrote this script in VBA in an Access form below:

Private Sub lblHuaweiReporting_DblClick(Cancel As Integer)
'This code created in part by Command Button Wizard.
On Error GoTo Err_lblHuaweiReporting_DblClick

DoCmd.OpenForm "Huawei Reporting", acNormal, , , acFormAdd, acWindowNormal, "Open_" & Me.Name
DoCmd.Close acForm, Me.Name, acSaveNo

Exit_lblHuaweiReporting_DblClick:
MsgBox Err.Description
Resume Exit_lblHuaweiReporting_DblClick

End Sub

I got a error at the beginning "Private Sub lblHuaweiReporting_DblClick(Cancel As Integer)" when I clicked on the command button. I am not sure what the error is. Do you have an idea?
 

1. You have On Error GoTo Err_lblHuaweiReporting_DblClick with no Err_lblHuaweiReporting_DblClick.

2. You have Resume Exit_lblHuaweiReporting_DblClick with no error handler.

3. You seem to be using Name as the name of an object. Name is a reserved word.


Randy
 
Randy:

I am not sure if I understand you. The error message I get is Compile error: Lable not defined. Your thoughts??
 
Dwayne/Randy

I got you. I just changed the name of the form and that seemed to work. Thanks!!
 
Randy/Duane:

Hey guys...I have a question regading VBA and pulling data from a REMEDY database via ODBC. I recently got ODBC connectivity to pull data from our REMEDY database. I am trying to automate a few of the reports I do manually and I am able to pull data via ODBC. I am able to do this using Excel by clicking on Data > Import External Data> New Database Query >. From that point I can pull down my tabales and the field names to generate a report. I am also able export the data into a spreadsheet.

WhatI want to accomplish is to pull the same data using ODBC using MS ACCESS. When I go to MS ACCESS and open a database and go the the display window under OBJECTS where I am under Tables. When I click on FILE > Get External Data > Import > Type of File = ODBC Databases. Next I select Data Source > Machine Data Source. The box AR system ODBC login. AR Server uet-reporting.corp.cox.com USERname DHARRIS password: dwayne49. At the Import Objects I then choose the table or tables I want. It always give me an error message the ODBC call failed. Why is that the case that I can use Excel and pull data via ODBC but not in MS Access.

Again I want to automate my reports using ODBC and MS ACCESS using forms and write scripts in VBA.
 
I have no idea why it fails. You might have unacceptable field names or data types or too many fields or to many characters in a record or ...

You might have better luck using a pass-through query rather than a linked table.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top