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

VBA with Excel and Access

Status
Not open for further replies.

mustangcoupe

Technical User
Feb 26, 2003
221
US
I am using VBA to automate some common tasks I do and I want to use excel (what I am typically using)to run access. I have opened the database and the form I need. next i am having a problem with the moving the data to the access database someone else created.
dim en as string
en=range("a2")
'a2 is just a tex field

appAccess.Forms![ESU form]!txtEN = en
'this enters the data from a2 to the textEN field and works
'in access there is an event procedure that runs when
'I type in the field and press enter but I cant get it to
'run from VB. it is located in the forms class module i
'tried the following with no luck any ideas?

call appAccess.Run("txtEN_AfterUpdate()")


the following is from the access class module and I didnt write it so I dont know how it works


'Purpose: after the value has been typed or selected in the txtEN combo box,
' the corresponding record will have its PIC field updated with the
' default print token
Private Sub txtEN_AfterUpdate()

Set db = CurrentDb
Set RecSet = db.OpenRecordset(TABLE, dbOpenDynaset)

' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[E_N] = '" & Me![txtEN] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark

Do Until RecSet.EOF
If RecSet!E_N = Me![txtEN] Then
RecSet.Edit
RecSet!PIC = PRINT_TOKEN
RecSet.Update
Exit Do
End If
RecSet.MoveNext
Loop

lstSelected.Requery
SetCount

End Sub


thanks
Todd
 
I think since this is declared as PRIVATE, you can't get to it from outside the module. Perhaps, change the declaration to PUBLIC and it might work?

HTH



Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!
 
nope, i have also tried that (changing it from private to public)sorry i forgot to mention that.

Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top