Resizing Data Bound Grid
How do I set the control to automatically resize the cells to fit all the text in??
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Data Bound Grid
How to retrive data using data grid ?
I am using ADO to access to the Access database.
Thanx
by Loh
Using Data Bound Grid
Hi,
I'm using VB6. In the data bound grid, there are 2 date fields. The first date field displays the data correctly. However, the second
date field will display the first field data if it contains a null value in the data file.
How can I display the second field as null value in the data bound grid ?
Thanks in advance !
Data Bound Grid
I went into components and clicked on databound grid and list so they will be on my tool bar. K that was no problem. I then tried to use the Grid and put it on my form (new) and it comes back with an error saying I do not have the license or it can't find the license ro run this component. I have VB6 SP4 professional. What do you think is the problem? or ddid I miss something in the components section?
thanks for your help.
Scoutt
Data Bound Grid Control (SP3)
I am using Visual Basic 6.0 on a Windows 2000 NT operating system. I have created a program on another pc which makes use of DBGRID32.OCX. However, when installing on new pc, I am encountring the following errors:
Line 52: Property OleObjectBlob in DBGrid1 could not be set.
Line 52: Cannot load control DBGrid1; license not found.
I have seeked Microsoft Knowledge Base and I found that I should register db grid by typing:
c:winntsystem32REGSVR32.EXE c:devpdbgrid32.ocx (In this case a message box appears stating that the file was registered.) Yet, the errors still occur.
Would be grateful if you could help me urgently.
Regards,
Renzo
How To Bound Some Data From SQL Query To GRID?
From some of my question about "How to use Grid without Database?" that no body answer me? Now I try to change my algorithm. The new question is "How to bound data from SQL Query to GRID?". I have been use GRID that bounded with some datasource and now I want to change it to SQL.
MS Data Bound Grid Control 5.0 (SP3)
I am using the Data Bound Grid Control in Unbound mode. I have 2 columns and would like to add a Name in the first column, Values (String) in the second column.
HOWEVER, when trying to populate the rows, my program stops at:
grd1.Row = 1
with error 'Application-defined or object-defined error'.
Alternatively, depending on grid properties, i get the error 'invalid row number'.
There does not seem to be a funtion to add rows.
HOW DO I ADD ROWS without this error occuring?
Once I do this I would like to be able to edit entries in the Value column only, but I think i can manage that bit ok!!
Simon
Data Bound Grid Control
Have just installed VB6 Professional Edition. I selected the complete option but don't seem to have the Microsoft Data Bound Grid Control 5.0 (SP3) as required by the Database Tutorial 3.
Could someone please tell me where I have gone wrong?
Data Bound Grid (this Is Tricky)
basically i want to hilight rows. I will be finding text and every row with that text in it i want to hilight . Now all i need to know is how to do it. Thanks..
Data Bound Grid Problem
I need to be able to add a new row so that i can insert the data from the database. but i am not sure as i have already tried using the for loop to increase the row number. This didnt work. Please Help.
Set rs = New ADODB.Recordset
Dim a As Integer
Dim b As Integer
SQLContact = "SELECT * FROM Contact WHERE aKey = " & lblKey.Caption & " ORDER BY Name DESC"
rs.Open SQLContact, cn
Do While Not rs.EOF = True
a = a + 1
rs.MoveNext
Loop
Set rs = Nothing
Set rs = New ADODB.Recordset
rs.Open SQLContact, cn
DBGrid.ApproxCount = a
'enters into a particular place of the grid
DBGrid.Refresh
DBGrid.ReBind
For b = 0 To a
If Not rs.EOF = True Then
DBGrid.Col = 0
DBGrid.Text = rs.Fields("First").Value
DBGrid.Col = 1
DBGrid.Text = rs.Fields("Name").Value
DBGrid.Col = 2
DBGrid.Text = rs.Fields("Telephone").Value
DBGrid.Col = 3
DBGrid.Text = rs.Fields("e-mail").Value
rs.MoveNext
End If
Next b
DataCombos Within A Data Bound Grid
Is there a way to have a DataCombo box within a column of a data bound grid? I am using VB6 with a SQL2000 database?
I would like for the user to be able to select from a list of values for certain columns of the grid.
Are there existing components that have this ability, or must it be coded?
Any help will be greatly appreciated.
Data Format To Bound Grid
I have a date field in a table that is in the format yyyymmdd and when I display it to a bound flexgrid I would like to reformat it to mm/dd/yyyy. I believe it can be done using the StdDataFormat but am having problems trying to make it work. Does anyone have an example, or a better way to do this?? Thanks in Advance!!
Licensing Problem Of Data Bound Grid
Hello All,
I have a problem with the Data Bound Grid control of Microsoft. When I
tried to place a Data Bound Grid control in a form, a message is coming
telling that the 'Licensing information is missing'. What could be the
reason for the problem. Is it possible to get the control with the licence
information from any site. If so, please direct me in the proper direction.
Please give the me the necessary information.
Thanking you in anticipation,
Sunil
J & P (O) Ltd,
Saudi Arabia.
Data Grid Bound To A SQl Server View
Hello freinds,
Most of you would have come across similar situations many times before and would have solved it in your own style and preference. let me explain the situation.
I have the
(1)ItemRefsLookup Table :
CREATE TABLE [dbo].[ItemRefsLookUp] (
[ItemRef] [varchar] (25) NOT NULL ,
[ItemDesc] [varchar] (50) NULL ,
[ItemType] [varchar] (10) NULL )
(2)ItemCostings Table :
CREATE TABLE [dbo].[ItemCostings] (
[ItemCostingsID] uniqueidentifier ROWGUIDCOL NOT NULL , [ItemRef] [varchar] (25) NOT NULL ,
[SubsidiaryCode] [varchar] (3) NOT NULL ,
[QuotedPrice] [decimal](18, 0) NULL ,
[ProdCost] [decimal](18, 0) NULL ,
[SellPrice] [decimal](18, 0) NULL ,
[Commission] [decimal](18, 0) NULL ,
[CurrencyCode] [varchar] (3) NOT NULL )
I have a foreign key declared as
ALTER TABLE [dbo].[ItemCostings]
ADD CONSTRAINT [FK_ItemCostings_ItemRefsLookUp] FOREIGN KEY ([ItemRef]) REFERENCES [dbo].[ItemRefsLookUp]
([ItemRef]) ON DELETE CASCADE ON UPDATE CASCADE ,
GO
Now I need to design a data entry screen for these two tables using Visual Basic 6.0.
(1) I created a View as follows:
CREATE VIEW dbo.VIEWItemRef
AS
SELECT dbo.ItemRefsLookUp.ItemRef AS ItemRef, dbo.ItemRefsLookUp.ItemDesc, dbo.ItemRefsLookUp.ItemType, dbo.ItemCostings.QuotedPrice, dbo.ItemCostings.SellPrice, dbo.ItemCostings.Commission, dbo.ItemCostings.ProdCost, dbo.ItemCostings.SubsidiaryCode,dbo.ItemCostings.CurrencyCode, dbo.ItemCostings.ItemCostingsID FROM dbo.ItemRefsLookUp INNER JOIN dbo.ItemCostings
ON
dbo.ItemRefsLookUp.ItemRef = dbo.ItemCostings.ItemRef
(2)Created a VB form with a DataGrid control in it with a ADODC control. The View was used as the record source for the Grid and then the ADODC was used as the source for the grid.
(3)Brilliant it does display the data properly allows me delete any rows selected and also allows me to edit the rows whichever I selected to edit.
(4)But when i try to add a new row it comes up with errors asking me to check on the status of each OLEDB.
(5)I have read in this forum that to insert using Views we have to use an Instead Of Insert Trigger.
(6) I did create a trigger in the lines what some freinds suggested as follows:
CREATE TRIGGER UTrig_INS_ItemRef ON [dbo].[ViewItemRef]
INSTEAD OF INSERT
AS
BEGIN
Declare @SubsCode As Varchar(5)
Declare @CurrCode As Varchar(5)
SET NOCOUNT ON
-- Check for duplicate ItemRef in ItemrefsLookup table . If no duplicate, do an insert.
IF (NOT EXISTS (SELECT IR.ItemRef
FROM ItemRefsLookup IR, inserted I
WHERE IR.ItemRef = I.ItemRef))
INSERT INTO ItemRefsLookup
SELECT ItemRef , ItemDesc, Itemtype
FROM inserted
IF (NOT EXISTS (SELECT IC.ItemRef
FROM ItemCostings IC, inserted
WHERE IC.ItemRef = inserted.ItemRef))
INSERT INTO ItemCostings
SELECT ItemCostingsID, ItemRef ,
'100' As SubsidiaryCode,
QuotedPrice, ProdCost, SellPrice, Commission ,
'HKD' As CurrencyCode
FROM inserted
END
(7)This trigger works fine when I directly try to do an insert using the Query Analyser. But it still wont work via the data grid.
I am really stuck and would appreciate if someone can help please. If you have different approach to design this data entry please do advice. Its only very recently I started using Stored procedures and triggers etc. So please ber with my ignorance.
Data Bound Grid Date Format
Is it possible to set the date format for the columns of a data bound grid (DAO)?
Right now, I have short date as the default format, but it comes up with 8/28//2002...
But I want it to be 28/08/02 instead.
Can this be done without setting the regional settings? I don't want it to change whenever the system changes regions.... thanks.
Passing Information From Data Bound Grid
I am having trouble finding the function to use in a data bound grid (DAO). What I'm trying to do, is to allow the user select a record from the databound grid, and then when he clicks the "edit" button, it would pass the "name" field from the data bound grid to a text field on the editing form.
I'm sure this can be done, but I couldn't find the function to do this. I have read about the selbookmarks function, but I don't understand how it can be applied here.
Please help... =(
Woobi.
Ammending Code To Show On Data Bound Grid
Normally when i open an ado code i do it as the code is below.
I would like to know how to ammend the code so it shows it in a databound grid???????????????
I know it has something to do with datasource property but cannot work out the correct place to place it and what to call it with.
I no longer want to show it in a textbox.
VB Code:
Private Sub Form_Load() Set r = GetData textbox1.text = r![InvoiceNo]End sub Public Function GetData() As ADODB.RecordsetOn Error Resume NextDim strsql As StringDim r As ADODB.RecordsetDim c As ADODB.Connection Set c = New ADODB.Connectionc.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False; Data Source=.home.mdb;"c.Open strsql = "SELECT * from Invoice"Set r = New ADODB.Recordsetr.Open strsql, c, adOpenDynamic, adLockPessimistic Set GetData = rEnd Function
Copy Text File Into Data Bound Grid In A Sorted Order?
I have a text file and i need to move its contents to DB Grid .
For Eg.
following is my test.txt
ravishah885 kent confirmed posted
ravi_sarla lamar pending
kent8541932 NCSU pending
kent8541933 ohio pending
kent86541934 northcarolina confirmed posted
for each line , I want "ravishah885" to be stored in one cell,"kent" in other ,"confirmed" in third cell and "posted" in fouth cell.
After storing all values i need to sort it in Data bound grid.
please mail me ASAP .
Thanx
ravi
Resizing Data Grid
Hi All
A while ago Shandy gave me this peice of code to resize a datagrid (MSDATGRD.OCX) on a form,
so it will occupy the entire area of a form, when the form is resized.
This works well, but I was wondering if there was some extra code to reszise the columns, because at the moment
the columns stay put, but the grey area around them fills the form.
Is there a way to move the cells/columns along with the rest of the grid when being resized ?
Thanks everyone
Oly
Bound Data Fields Not Bound
I am connecting to an Oracle data base via ADO. When I open my form the first time, the first record is displayed, but then, when doing a "moveNext" or "movePrev" or a "moveFirst" or a moveLast", the fields are not updated on the screen, but when I check the recordset programmatically, the record is the correct record (the next record or previous record and so on).
Now, for the crazy part: when I close this form and open it a second time all is well, the first record is displayed and as I navigate through the recordset (next, prev, first, last) the correct record is displayed on the form.
Any ideas?
Thanks,
zina
Bound Grid
Hi All
I wonder if someone can tell me how I can add an extra column to my bound grid. I have tried increasing the column setting but it will not reconise the extra column.
Can anyone please help
Thanks
Non-bound Grid
Is there a Grid or grid-like control in VB that I can use to manually fill with data ( I don't want to bind it to a data control or recordset) and also let the user edit the text directly in the cells?
I don't want to try binding it to a recordset because I want to verify and limit what the users can enter.
- Flexgrid and HFLexgrid are easy enough to fill manually but you can't edit cells directly (Is this true??)
- Datagrid and DBgrid can't be used unbound (Is this true??)
Is there something that I'm missing?
Grid Bound To A Recordset
any idea about to bind a grid to an ADO 2.7 recorset so when move between rows in the grid the recordset record pointer moves at the same time?
Thanks
rguia
Is There A Grid Control Not Bound To A Database?
I'm looking for a grid control that does not need to be linked to a database. I have a text file with a bunch of records each on a separate line.I want to be able to present this data to the user in a grid format so they can edit fields. Exactly like a spreadsheet would work. I tried using OLE with Excel but it always shows the menu at the top and I can't rename the coumns. The closest thing I've found was the ListView control, but it will not let me edit SubItems as far as I know.
Bound Grid Or Disconnected Recordset?
Hello,
I have a Grid that I displays to the user 6 columns of information. 4 of the 6 columns are derrived from one column value from the database. My question is which approach would be the best for my App to update the results captured by the grid. Because the grid has derived columns that make it easer for the user to choose the mask value for each record...I thought of two ways I could update the underlying table.
1) 2 Grids one Bound and one unbound.
I could have one grid(A) that represents the the data that I want updated and bind it to the database but keep it invisible and have it work with my other grid(B) when the user updates rows in grid(B) have code that updates rows in grid(A) as they are changed.
Grid(A) ColumnA=dbKey ColumnB=MaskInteger <this would match directly to the table>
Grid(B) ColumnA=GroupID, ColumnB=Description, ColumnC-D=Boolean <this information is collected by several table by joins to get User friendly data for the User>
2) 1 Grid and 1 disconnected Recordset
I could also use a disconnected Recordset with ADO instead of using the Bound Grid(A) use similar logic using the events in the grid(B) to update the recordset the have user commit changes when they click a apply button.
Any Ideas or comments how I could implement these or other ideas? I would enjoy any examples as well!
Thanks
Richard
Truegrid V7 Summing Two Columns On Bound Grid????? PLZ HELP!!!
Hi All,
I'm using Truegrid V7 and I am showing stock figures using a bound ado control. That bit is fine but I also want to have one of the columns as a sum of the other two. Does anyone have any ideas as I am well and truely stuck!
Thanx very much inadvance,
Jiggy!
Bound True Grid Dont Refresh After Delete
I'm having a problem with the grid not getting refreshed after
deleting a record. Even though the record is deleted from the table. I
have the following code in a Delete button event:
sql = "Delete from OrderDetails where Orderid = " &
datOrderItems.Recordset!OrderId
sql = sql & " and ProductId = '" &
datOrderItems.Recordset!ProductId & "'"
gconn.Execute sql
datOrderItems.Recordset.Requery
datOrderItems.Recordset.MoveNext
If datOrderItems.Recordset.EOF Then
datOrderItems.Recordset.MoveLast
End If
datOrderItems.Recordset.Filter = "Orderid = " &
cmbOrders.Columns.Item(0).Text
grdOrderDetails.ReBind
Why does the row that was deleted still show in the grid after the
delete. If I change the filter on the recordset, it will display the
new results, but when I come back to the old Order#, the same contents
will display, even the deleted record. If I close the form and load it
again, the record gone. What the heck is going on. Please help.
Thanks Michael
Resizing My Sudoku Grid
Hello. Everything's working nicely with the logic, but now I need to focus on users being able to resize the form (and thus the grid) for my Sudoku program. It's a nine by nine grid with a number in each box, and currently I'm using text boxes, although it wouldn't be a problem to use another control to show the numbers and accept the input, the main thing is just getting the numbers once inputted to resize along with their boxes.
How would you go about resizing these boxes with numbers?
Msflex Grid , Col Resizing.
Hi
I have a flex grid on a form showing the contents of the table I am linked to. But the cols are to smal to show all the data. How do you make the col automatically adjust to show all the data and the table field names in full in the msflex grid ?
Rgds, Locutus
Grid Column Resizing
Hey all,
Any ideas on resizing the grid columns when the form is resized!
The math for it!!
It's for a true dbgrid!
Cheers
Beacon
DBGrid, Bound Data, Moving Rows Does Not Update Data Proper
I am using the standard data control along with a DBgrid, I also have text boxes with some of the same data as the dbgrid.
I have the DBGrid and the recordset that populates the DBGrid
and the text boxes bound.
When I change rows in the dbgrid the data changes in the text boxes as I expected but I am also doing a "record number of number of records".
As well as some other stuff similar to the record counts.
Anyway all the text boxes update when I change rows in the DBGrid
but the other stuff does not update proper.
Strange though if I click on say the third line down on the dbgrid
everything updates but the record counter. Then if I click on say the
fifth line down the text boxes update with the correct data but the
record counter will then say record 3 of xx records. Then if I click on
say the 1st line everything updates proper except the record counter.
It will now say record 5 of xx records. Well by now you get the picture the other stuff lags behind by one row click.
I have tried
Private Sub DBgrid1_click()
data.recordset.refresh
End Sub
I also tried
Private Sub DBgrid1_click()
data.recordset.movenext
data.recordset.moveprevious
End Sub
Still doesn't work?????????
Any suggestion would be helpful.
MSFlexGrid Scrollbars Are Not Visible After Resizing The Grid.
I have a form that is a child form in an MDI setup.
This child form has four tabs and on each tab is an MSFlexgrid.
All data in the flex grids are inserted manually.
When data is entered on one of the four flex grids (call it flexgridalpha, it can create many new rows in one of the other flexgrids (call it flexgridbeta)...
So, flexgridbeta starts with a grid with 24 rows. Then the user tabs to flexgridalpha and makes some changes that generate 50 new entries that are entered into the table that feeds flexgridbeta. The user then selects the flexgridbeta tab to see his 74 rows.
The data appears just fine, but the vscrollbar is not visible. Clicking where the scrollbar SHOULD be causes that part of the scrollbar to become visible. (ie if you click where the arrows should be, they will suddenly reappear, or if you click between the two arrow, the thumb and scroll bar appears but the arrows don't appear, yet).
Any suggestions?
Thanks,
MagicT
Resizing A MS Flex Grid Column To Fit The Longest Value
hi,
I want to allow the user to dbl click on the column resize mark in order to resize it automatically to the longest value (makes all the values visible).
Same behaviour as in Windows Explorer and most of MS apps.
Is there a more elegant way of doing it other than going over each cell in the column and checking it's Width?
How do I catch the dbl click specifically on the resize mark?
thanx
HELP With Data Control And Data Bound List Box
Hi
I am new to Visual Basic and need some help.
I have a Data Control connected to an Access data base, the data base is
very simple with one table and six fields.
I have got text boxes etc. bound to the Data Control, this is all fine.
I have also got a Data Bound List box bound to the data control which is
great to lookup the data in a field of the data base. The only way I can
find of browsing the data is using the arrow buttons of the data control.
Can I change the Recordset of the data control by selecting the record
from the Data Bound List box. Is it possible to do this in code? or at all?
Have I approached this from the wrong direction?
To explain what I require- I need to have a list of the contence of one
field in by data base (say names). I need to select one record (click on
it) and show all the other fields for that record.
Incredibly simple though it sounds I can't find a way of doing it.
Any help much appreciated.
Thanks
Toby Treacher
Displaying Data In A (data Grid / Flex Grid)
hi i would like to know how to connect to a Access database and display all records in a flex grid in VB
also i would like to know how to achive the above task from a SQL dadabse using ADO.. in VB
Plz help me...
Shabbeer
Read A Data Bound Value On The Fly
hi
what i want to do is to read a value on the fly basically. i have bound a label on a form to a database that displays an ID number. now i cannot seem to read the current value of this number on the fly i have to use a button.
I am not sure when and how to get the correct number. If i use the event label1.TextChanged event it still shows the previous number, but on display (on the form) it has updated and shows the correct value.
something like this (but not exactly):
label1.databindings.add("text", dstables, "ID")
private sub label1.TextChanged (byval etc) handles label1.TextChanged
messagebox.show(label1.text)
end sub
Data Bound Combo Box
I'm trying to create a program that will populate a data bound combo box from a table in a database. I keep setting the fields to what I want them to be in the properties window, but I'm still only getting one record in the combo box. I have set the databound list controls in the components menu, and the path in my data object is correct and working fine. I just can't get the stupid thing to populate. Any ideas?
Bound Data Report
Hi all,
My disaster of the day (besides being a newb) is a data report that is bound to a data env. This part works fine.. master records.. detail records.. ect. I am trying to add data from a non related table that consists of a global "due date" etc. that I don't want to make static (would like to use the program next year) and didn't want to include in the master/detail tables since it is the same for all records. Managed to struggle my way thru this far, but stumped at the moment.
Your expertise appreciated
Howard
Data-bound Objects
Hi All... a question please.
I have built a database in Access to store Employee information. The Visual Basic form I have designed to populate / view the database records includes text boxes and a combo box.
The combo box is used to ented / display an employees pay frequency (weekly / monthly etc) and I have used the combo box's List property to 'store' legal responses.
By binding the form's objects to the database, I can add new enteries, but when I try to call-up records from the database, I get a 'text property is read only' error from the combo box.
Can someone please tell me how to get around this ?
Thanks.
Deane
Data Bound Controls
Just firing off questions hope this don't offend anyone but I am hoping one will get answered.
I have an access table its got a large number of fields on it. Say 150 for sake. Now when I try and bind those 150 fields it takes I swear like 2-3 minutes to open up the recordset with the ADO control I am using.
However I am able break the table down into 4 smaller tables. and bind the fields through code. I simply set their datasource fileds at design time and then manually bind these fields to the ADODC by a line of code Text1.Datasource=ADODC1 and it seems to work like 10 times faster. But its more upkeep. Is there a quicker way to bind these fields and hopefully get it back to being one table as its taking much longer to navigate four tables similtaneously for lookups and such.
Mr Tremor
Data Bound Controls?
Hi,
In this forum, most experts/professional developers saying try to avoid to use the data bound controls for ADO and just do the manually coding / SQL statement instead.
But I have another project that will develop on VB.net / express, so just wonder is the same concept still apply? avoid to use the data bound controls even in vb.net/express?
Thanks!
Data Bound Control
did your guys like data bound control? I personal feel it is suck when come to writing code for data manipulate like (add, edit, delete)
How you think about this?
Data Bound Controls
I have (2) dbCombo boxes on a form.
The first box is filled with choices from a database (Names of Manufacturers)
The second one is filled with detailed choices, about the subject listed in the first combobox. (Names of Manufacturers Models)
On form load it all works fine, but when I click on the First combo box, I want the choices listed in the second combo box to (movenext) to that record in the file.
Each combobox is linked via Data1 & Data2
A variable is given to the first combo box (dcbManufact.text), however. When debugging I noticed that the statement:
strManufact = dbcManufact.text
will apply a nullstring at that point in the code, because during run time, the text does not change until the app. gets to the END SUB statement.
Any Suggestions?
Code:
Code:
Option Explicit
Private Sub cmdExit_Click()
Unload frmNotes
Unload frmLogin
Unload frmLocks
Unload Me
End Sub
Private Sub cmdGo_Click()
strManufact = dbcManufact.Text
Data2.RecordSource = strManufact
cmdLock.Enabled = True
cmdNotes.Enabled = True
cmdPrint.Enabled = True
Data2.Move (strConnect)
End Sub
Private Sub cmdNotes_Click()
frmNotes.Show (vbModal)
End Sub
Private Sub dbcManufact_Change()
Data2.RecordSource = strManufact
End Sub
Private Sub Form_Load()
Me.Top = (Screen.Height - Me.Height) / 2
Me.Left = (Screen.Width - Me.Width) / 2
Data2.RecordSource = strManufact
Me.Show 'Used for debugging
cmdNotes.Enabled = False
cmdPrint.Enabled = False
cmdLock.Enabled = False
Data1.DatabaseName = App.Path & "Manufacts.mdb"
Data2.DatabaseName = App.Path & "Safes.mdb"
End Sub
'Code improved by vBulletin Tool (Save as...)
Data Bound Text Box
Hi,
In "Visual Basic 4 Application", which property of TextBox I need to useto bound it to ADODC control.
Any help will be greatly appreciated.
Tanu
Add Data To Bound Datagrid
I have a VB 6 form that is bound to an Access database with two tables. The parent table has databound controls (text boxes, combo boxes, etc.) on the form; the child table, which can have multiple records for each record in the parent table, is on the form in a databound datagrid.
I want to be able to completely copy an entry displayed on a form and create a new entry in the database with the duplicated information (just the ID code would change, which the user would have to input). It’s easy to copy the data in the parent table and repopulate its controls, but I’m stymied on the datagrid. I can’t figure out a way to add data to it programmatically. There doesn’t seem to be an AddNew method or anything similar to add a line to the grid. I thought about using an SQL INSERT command, such as
“INSERT INTO Child (DataKey) VALUES (" & sDKey & ")”
where sDKey is the linking key that is the same in both parent and child tables, but I get the error message:
You cannot add or change a record because a related record is required in the table ‘Parent’.
I thought about using a single SQL command to enter records into both Parent and Child tables, but wasn’t able to figure out a way to do that. I thought perhaps a multi-table query would work, but if that’s possible, I don’t know how to design it properly. And I’m not sure how I’d use that to enter several rows into the Child table with just one in the Parent table.
I’ve looked through all the documentation I can find about how to enter data into a datagrid, and everything seems to presume the user will enter the data, rather than it being done by the program. Can anyone suggest a solution?
Data Bound Controls..
Hi,
In my VB6 aplication I need to use a data control..
This data control should be simple which will just hold two columns from a table..
user can update and delete and add the data
i was thinking of a dataGrid..But it seems there is lot of code behind
If we need to update del or add new rows..
In a dataGrid is it necessary to have Text box to hold individual values which need to be updated or deleted
What is the best way to do this.
Thanx
Pinky.
Data Bound Controls
Hi all, I am setting up a program in VB that uses data bound controls. What I need to do is use two separate tables in one database (Access) that automatically fills in the city and state once a user types in the zip code. One of the tables must contain 20 zip codes with cities and states in the same record. I believe that I have the form set up correctly, however
the problem that I am having is getting the textbox info (City and State) to move according to what zip code I choose. When I start the program, it has a zip code in the data control combo box and the city and state are automatically in the fields (which does match the zip code). However, when I choose a new zip code, the old city and state remain at the previous names and do not change with the zip code changes. Any ideas on how to fix this?
Data Bound Controls
Which data bound control is better to bound to a boolean field of database?
|