I have a form in which I search using the ID. Once I found the ID in the table there are title, artist which fills from the table. After the search operation I want to store the values of the form in a grid so I kept a button but not able to know how to pass the values from the text box to the grid
A Grid is a bunch of controls for a whole table/alias, a textbox is a single field control. The grid does not work like an excel sheet with cells, but rather like a browse.
So what you typically do is bind the grid to a table (rowsource) and a textbox to some field of the same table (controlsource) then you can navigate to a record in the grid, type in something into the textbox and thereby edit the grid.
Or you keep the textboex unbound, then for example use an insert-SQL to add the new values to a new record.
eg in the add button click do INSERT INTO thealias (thefield) VALUES (thisform.text1.value) and THISFORM.grid1.refresh()
thealias should be the aliasname of the table you want to add to and which is displayed by the grid.
A GRID has a ControlSource. That is a Cursor or a Table.
The TextBoxes also have ControlSources. They can either be bound to cursor/table fields or they can be independent memory variables.
If the TextBoxes are bound to a cursor/table, the values entered will be automatically entered into its associated table (depending on the table buffering method used). If the Grid is using this same table for its ControlSource, then no problem - Done.
If the TextBoxes are using memory variables, then you can enter a new record and utilize REPLACE to populate the associated fields. After which you would probably do a ThisForm.Grid1.Refresh to ensure that the data was displayed.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.