mustangcoupe
Electrical
- Nov 13, 2002
- 10
I am having a problem calling a access event procedure from excel. I added a button to envoke the procedure (as recommended in another therad).
what I really want to do is look at a cell in excel take the value and then enter that value in a text box in access. that text box in access uses a event procedure (onupdate) to update the rest of the form baised on the value in the text box. SO I addes a hidden button on the access form called hiddenbutton and now I get a compiler error expected =
this is probally SO easy for some of you to figure out....
but I am stumped
Private Sub CommandButton1_Click()
Dim appAccess As Object
Dim en As String
Dim r As Integer
Dim c As Integer
Set myrange = Range("A10:A60"
Set appAccess = CreateObject("Access.Application"
appAccess.OpenCurrentDatabase "M:\rds.mdb"
appAccess.docmd.OpenForm "ESU form"
appAccess.Forms![ESU form]!txtEN.SetFocus
r = 1
c = 1
For r = r To 50
en = myrange.Cells(r, c)
If en = "" Then
r = "50"
Else
appAccess.Forms![ESU form]!txtEN = en
appAccess.Forms![ESU form]!cmdhiddenbutton.Click()
End If
Next r
appAccess.Application.Quit acEXIT
Set appAccess = Nothing
End Sub
please help
Todd
what I really want to do is look at a cell in excel take the value and then enter that value in a text box in access. that text box in access uses a event procedure (onupdate) to update the rest of the form baised on the value in the text box. SO I addes a hidden button on the access form called hiddenbutton and now I get a compiler error expected =
this is probally SO easy for some of you to figure out....
but I am stumped
Private Sub CommandButton1_Click()
Dim appAccess As Object
Dim en As String
Dim r As Integer
Dim c As Integer
Set myrange = Range("A10:A60"
Set appAccess = CreateObject("Access.Application"
appAccess.OpenCurrentDatabase "M:\rds.mdb"
appAccess.docmd.OpenForm "ESU form"
appAccess.Forms![ESU form]!txtEN.SetFocus
r = 1
c = 1
For r = r To 50
en = myrange.Cells(r, c)
If en = "" Then
r = "50"
Else
appAccess.Forms![ESU form]!txtEN = en
appAccess.Forms![ESU form]!cmdhiddenbutton.Click()
End If
Next r
appAccess.Application.Quit acEXIT
Set appAccess = Nothing
End Sub
please help
Todd