parameter in combobox

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
 
A

Alejandro

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
 
R

Rod Scoullar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top