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!

Can't run an event procedure (Access2007)

Status
Not open for further replies.

pkameni

Programmer
Aug 23, 2009
1
CM
I have a formREGION and a SubFormTown
I have 2 tables tables
TblREGION avec 2 champs
- RegCode(2)
- NomReg(20)
TblTown avec 3 Champs
- TownCode(4)
- TownName
- CodeReg(2)
The TownCode must be built with CodeReg + 2 Char previously typed by the user in the field TownCode.
As the user type the info in SubFormTown, I would like to automaticly assign the 2 Char of RegCode to the field TownCode. The 2 others Char that would be typed shoud be concatenated to the others. And, update the record.
This is what I tried:
I have a formREGION and a SubFormTown, I have 2 tables
TblREGION with 2 fieldss
- RegCode(2) - NomReg(20)
TblTown with 3 fields
- TownCode(4) - TownName - CodeReg(2)
The TownCode must be built with CodeReg + 2 Char previously typed by the user in the field TownCode.As the user type the info in SubFormTown, I would like to automaticly assign the 2 Char of RegCode to the field TownCode. The 2 others Char that would be typed shoud be added. I tried this:
Private Sub CodeVille_BeforeUpdate(Cancel As Integer)
Dim CodeV as Variant
CodeV = Inputbox("Entrez le code ville")
Me![CodeVille]= Me![CodeReg] & CodeV
End Sub
The procedure does not run. Please Help
 
Have you enabled your code yet?
If Me.CodeVille is a control on a form, the BeforeUpdate event does not run until the value has been changed and the control looses focus.


(RG for short) aka Allan Bunch MS Access MVP acXP ac07 winXP Pro
Please respond to this forum so all may benefit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top