mustangcoupe
Technical User
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
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