continuous form update row

G

Guest

I have a continuous form that has a combo box that the users selects and
depending on their selection I want to update another field on that row.
when I use the code below it gets the first record in the form not the record
they are on. Can I get the change to be made on the correct row?

Private Sub CmbToInfo_AfterUpdate()
Me.Requery
NewCirc = "z" & Me.TOINFO.Value & "-" & Me.Voltage.Value
Me.txtCircuit.Value = NewCirc
End Sub
 
R

Rick Brandt

Cynthia said:
I have a continuous form that has a combo box that the users selects
and depending on their selection I want to update another field on
that row. when I use the code below it gets the first record in the
form not the record they are on. Can I get the change to be made on
the correct row?

Private Sub CmbToInfo_AfterUpdate()
Me.Requery
NewCirc = "z" & Me.TOINFO.Value & "-" & Me.Voltage.Value
Me.txtCircuit.Value = NewCirc
End Sub

Get rid of...

Me.Requery
 
G

Guest

Thank you. I see now the requery takes me back to the first record. I
appreciate the fast responce.
 
G

Guest

I also have two update queries that are similar the first one runs but not
the second one. any suggestions? I replaced the " with ' on '%ENCLOS%' and
it still does not change the data?

update qryQCircToFrom set idtoinfo = 6368, circuit = 'z3413-BAT-0001' & '-'
& voltage where (((idtoinfo) = 6368) and ((circuit) like 'z%')) and
((qryQCircToFrom.ToInfo Like "%BAT-0002"));

update qryQCircToFrom set idtoinfo = 739, circuit = 'z3413-BAT-0001' & '-'
& voltage where (((idtoinfo) = 6368) and ((circuit) like 'z%')) and
((qryQCircToFrom.ToDescr Like "%ENCLOS%"));
 
J

John Smith

Assuming that you are running these queries in Access you need to use '*' as
the wild-card rather then '%'. Your queries would then be:

update qryQCircToFrom set circuit = 'z3413-BAT-0001-' & voltage
where idtoinfo = 6368 and circuit like 'z*' and ToInfo Like '*BAT-0002*' ;

update qryQCircToFrom set idtoinfo = 739, circuit = 'z3413-BAT-0001-' & voltage
where idtoinfo = 6368 and circuit like 'z*' and ToDescr Like '*ENCLOS*' ;

HTH
John
##################################
Don't Print - Save trees
 

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

Top