PDA

Click to See Complete Forum and Search --> : Updating a database


bon
Jan 23rd, 2000, 01:19 PM
I have this DBgrid that retrieves records from the database based on a certain criteria.The question is, when a retrieved record is selected either by double clicking on it or clicking a command button(Select), a form that was used to save changes must appear for a user to update.

Can someone please tell me the code that I can use to achieve this.

Thanks.

netSurfer
Jan 23rd, 2000, 08:33 PM
frmSave =a form that was used to save changes must appear for a user to update

frmGridsForm = form with the grid on it


In the DBGrid_click or dblClick event and the cmdSelect_click event:

frmSave.show 1 'opens the form

'then in the frmSave_load event:

intRow = frmGridsForm!DBGrid.row
intCol = frmGridsForm!DBGrid.col

'now you have the row and col, it should give you the record you want to edit

if the record Key is in the first col -

frmGridsForm!DBGrid.col = 0
strRecordKey = frmGridsform!DBGrid.text

then just connect to your db and grab the info. Hope this helps.