Change in DB not showing on form

nkechifesie
12-15-2006, 07:24 AM
When i edit the data in the database, the form doesnt show the effect unless i scroll back and then forward. Please can you help.
Below is the code am using

If (MsgBox("Are you sure you want to Edit Vehicle Type: " & RsVehType("txtVEHTYPE"), vbYesNo, "VEHICLE TRACKER") = vbYes) Then
response = InputBox("Enter the new Vehicle Type", "VEHICLE TRACKER")
response = UCase(response)
AdVehType.Execute "UPDATE tblVEHTYPE SET txtVEHTYPE = '" & response & "' WHERE txtVEHTYPE = '" & TxtType.Text & "';"
RsVehType.Requery
End If

Shurik12
12-15-2006, 07:25 AM
How are you displaying your data: textboxes, datagrid, msflexgrid,mshflexgrid....?

morbidangel
12-15-2006, 07:27 AM
What control are you using to present the data on your form? Maybe you should refresh your control after the update in order to show the changes

nkechifesie
12-15-2006, 07:39 AM
Am using text box to display and Ado to connect

PianoMan
12-15-2006, 08:33 AM
When i edit the data in the database, the form doesnt show the effect unless i scroll back and then forward. Please can you help.

At what point do you display the info in the textbox initially? As has been suggested, if the information you want to display has changed, you'll need to refresh the information in the textbox as well. It won't "automatically" update itself.

nkechifesie
12-15-2006, 08:40 AM
Thank you, I have done that now and it works. Would have prefered though if it could show the record that was edited and not go back to the beginning on the record.

PianoMan
12-15-2006, 09:00 AM
Thank you, I have done that now and it works. Would have prefered though if it could show the record that was edited and not go back to the beginning on the record.
Maybe I'm not understanding the problem. I'm slow like that sometimes ;)

Why not If (MsgBox("Are you sure you want to Edit Vehicle Type: " & RsVehType("txtVEHTYPE"), vbYesNo, "VEHICLE TRACKER") = vbYes) Then
response = InputBox("Enter the new Vehicle Type", "VEHICLE TRACKER")
response = UCase(response)
AdVehType.Execute "UPDATE tblVEHTYPE SET txtVEHTYPE = '" & response & "' WHERE txtVEHTYPE = '" & TxtType.Text & "';"
RsVehType.Requery
End If
txtUpdatedText = txtVEHType 'Or whatever textbox you want updated...

Or are you using a textbox that's bound?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum