parameter in combobox

  • Thread starter Thread starter Alejandro
  • Start date Start date
A

Alejandro

I have while controlled by a combobox (me.fabricx), but only work if i write the number directly , here is the working code:

Private Sub des1_AfterUpdate()
Do While Me.fab = 244
intera = Me.custo - Me.custo * Me.des1 / 100
Me.inter = intera
DoCmd.GoToRecord , , acNext
Loop
DoCmd.GoToRecord , , acFirst
End Sub


but i need the code like this :


Private Sub des1_AfterUpdate()
Do While Me.fab = me.fabricx
intera = Me.custo - Me.custo * Me.des1 / 100
Me.inter = intera
DoCmd.GoToRecord , , acNext
Loop
DoCmd.GoToRecord , , acFirst
End Sub


But when i write me.fab=me.fabricx the code dont work, where is the error ????


Thanks in advance
Alejandro Carnero
 
Thanks Rod, i have resolve my problem with this variable but i have declare
him as integer
dim prop as integer

Private Sub des1_AfterUpdate()
prop = Me.Fabricx.Column(0)
Do While Me.fab = prop
intera = Me.custo - Me.custo * Me.des1 / 100
Me.inter = intera
DoCmd.GoToRecord , , acNext
Loop
DoCmd.GoToRecord , , acFirst
End Sub

Alejandro Carnero
Santos Brazil
 
Each time you move to new record the combobox value is changed.

Save the initial value in a variable and use that.

Private Sub des1_AfterUpdate()
Dim Val As Long

Val = me.fabricx
Do While Me.fab = Val
intera = Me.custo - Me.custo * Me.des1 / 100
Me.inter = intera
DoCmd.GoToRecord , , acNext
Loop
DoCmd.GoToRecord , , acFirst
End

Rod Scoullar
 
Back
Top