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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing rec selection

Status
Not open for further replies.

savok

Technical User
Jan 11, 2001
303
AT
I have a grid, when the user clicks on it, it gets the id out of it, opens a new form and based on that id fills the boxes with the appropriate info. It works fine but when you close the form and go back to the grid and select another customer and open that form all the info stays the same. I checked if the ID changes and it does. Anyone know what I can be doing wrong?
 
i clear the boxes on form load it still doesnt work :(


when you say before executing the .seek do you mean before i select the rec out of the database?
 
Paste Your Codes or SQL string here What you are doing (click event on the grid )

Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
this is the grid click event on form1

Private Sub Grid_Click()
strID = Grid.TextMatrix(Grid.RowSel, 1)
End Sub

when the user clicks on edit button it opens form2, which opens the record based on the strID and fills the text boxes

this is the form_load event of form2

Set objConn = New ADODB.Connection
Set objComm = New ADODB.Command
Set objRec = New ADODB.Recordset
objConn.ConnectionString = "DSN=*;UID=*;SERVER=*;PWD=*"
objConn.Open
objComm.ActiveConnection = objConn
objComm.CommandText = "Select * from table where id = '" & strID & "'"

objComm.CommandType = adCmdText
Set objRec.Source = objComm
objRec.Open

If objRec.EOF Or objRec.BOF Then
MsgBox ("EOF/BOF")
Else
load info into text boxes
End If
objRec.Close
objConn.Close


this works just fine for the first time i open a record, but if i close form2 and open form1 and select another user and click on edit when form2 opens it has all the info from the first time i opened it. Even though the strID changed.

thanks for the help :)


 
meaby :

objComm.CommandText = "select id, * from table where id Like '%" & strID & "%'"
Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top