Advertisement

02.19.2007 at 05:22PM PST, ID: 22399954
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Expression OnClick you entered as the event property setting produced the following error: Invalid outside procedure

Asked by ramrodcar in Access Forms, Microsoft Access Database, Microsoft ADP

Tags: , , , ,

I'm using ADP in access to sql server 2005, trying to get a button click event working. I think i'm missing a reference in the VB editor but i don't know which one. I'm getting this on any of my onclick button events: The Expression OnClick you entered as the event property setting produced the following error: Invalid outside procedure

Here's my code, it happens on btnBrowse_Click event which calls GetCSVName

'column headers in csv file
Const hdrIntMonthID = "intMonthID"
Const hdrIntBranch = "intBranch"
Const hdrIntReportMonthID = "intReportMonthID"
Const hdrTxtMachCode = "txtMachCode"
Const hdrIntDistTerritoryID = "intDistTerritoryID"
Const hdrIntUSUnits = "intUSUnits"
Const hdrTxtMachCategory = "txtMachCategory"
Const hdrDttLastUpd = "dttLastUpd"

Dim hdrLst() As String
Dim strTableName As String
strTableName = "tblBranchDataEntry"
Dim rstData As Recordset
Set rstData = New ADODB.Recordset
Dim strSQL As String

Sub GetCSVName()
Dim dlgOpen As FileDialog

  Set dlgOpen = Application.FileDialog(msoFileDialogOpen)
  With dlgOpen

    .AllowMultiSelect = False
    .Filters.Clear
    .Filters.Add "Comma Delimited Files", "*.csv"
    .Show

    If .SelectedItems.Count > 0 Then
      txtCSVName.SetFocus
      txtCSVName.Text = .SelectedItems.Item(1)
    End If

  End With
End Sub

Sub LoadCSV(fn As String)
'we don't want to delete records, we want to append to this table





FN1 = FreeFile
Open fn For Input As FN1 'open file
Line Input #FN1, t          'the first line of text is headers
ParseCommas t, hdrLst       'break down commas in header

RowNumber = 0
'repeat until we get to the end of the file.
Do While Not EOF(FN1)
Line Input #FN1, t
'If Len(t) > 0 Then
    RowNumber = RowNumber + 1
    ParseCommas t, RowData
   
'    For k = LBound(hdrLst) To UBound(hdrLst)
'    Select Case UCase(hdrLst(k))
'        Case hdrIntMonthID
'End If

SaveDataRow RowData
Loop
Close #FN1
Set rs = Nothing
   
End Sub

Sub ParseCommas(h As String, a() As String)

Dim cp As Integer                         'comma position
Dim ip As Integer                         'index position
Dim ht As String, ht2 As String           'header text

  ip = 1
  ReDim Preserve a(0)

  Do While ip < Len(h)

    cp = InStr(ip, h, ",")                'find next comma

    If cp > 0 Then                        'if we find a comma

      ht = Trim(Mid(h, ip, cp - ip))      'get text between prev & next commas

      If Left(ht, 1) = """" Then          'is it a quote mark?

        Do Until Right(ht, 1) = """"      'find the other one
          cp = InStr(cp + 1, h, ",")      'find next comma
          ht = Mid(h, ip, cp - ip)        'get the rest of it
        Loop
        ht = Mid(ht, 2, Len(ht) - 2)      'get everything but quote marks

      End If

      ht = TrimTabs(Trim(ht))             'strip spaces then tabs

      a(UBound(a)) = ht                   'add to list
      ReDim Preserve a(UBound(a) + 1)

    Else
      GoTo EarlyExit                      'ran out of commas
    End If

    ip = cp + 1                           'move past comma

  Loop

EarlyExit:
  'out of commas, copy remainder of string
  If ip < Len(h) Then a(UBound(a)) = Right(h, Len(h) - ip + 1)

End Sub

Sub SaveDataRow(d() As String)

strSQL = "INSERT INTO " & strTableName & _
" (intMonthID,intBranch,intReportMonthID,txtUSMTCMachCode,intDistTerritoryID,intUSUnits,txtMachCategory,dttLastUpd)" & _
" VALUES(" & d(0) & "," & d(1) & "," & d(2) & "," & d(3) & "," & d(4) & "," & d(5) & "," & d(6) & "," & Now & ")"
rstData.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
End Sub


Private Sub btnBrowse_Click()
GetCSVName
End Sub
Start Free Trial
 
Loading Advertisement...
 
[+][-]02.19.2007 at 05:45PM PST, ID: 18567758

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.19.2007 at 05:48PM PST, ID: 18567770

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.19.2007 at 05:59PM PST, ID: 18567802

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.19.2007 at 06:01PM PST, ID: 18567803

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.19.2007 at 07:13PM PST, ID: 18568044

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.19.2007 at 07:16PM PST, ID: 18568060

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Forms, Microsoft Access Database, Microsoft ADP
Tags: expression, entered, you, event, property
Sign Up Now!
Solution Provided By: Arthur_Wood
Participating Experts: 3
Solution Grade: A
 
 
[+][-]02.20.2007 at 06:30AM PST, ID: 18570611

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.20.2007 at 06:32AM PST, ID: 18570625

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42