VB & Access question

Status
Not open for further replies.

Saint

Ars Legatus Legionis
51,842
My friend and I are doing a project, and he has this question:

I am
> currently having some trouble with linking my DBgrid to my data > control. At the moment, the data control is being populated by an
encoded
> SQL query, so i can't link the DBgrid's datasource to the dataconrol in > the properties window because the data control has no recordsource. As > such I have tried to code this in, directly following the SQL statement > that populates the data control's recordsource, using he following > statement: > > Set grdDataGrid.DataSource = datPrimaryRS > > However, I get a data mismatch error and I am unclear why. > Is this the right code? (grdDataGrid = my DBgrid and datPrimaryRS= my > datacontrol) > > Secondly if I want to repopulate the DBgrid every time the user changes > customers must I requery the data control or refresh the dbgrid? > > Thank you,
 

A.W.

Ars Tribunus Angusticlavius
6,790
Originally posted by Rictus:
Ummmm....try not to cut and past an entire email ('>'s and all) and ask us to wade through it trying to figure out what you wrote.


Maybe clean it up bit and see if some of these programmers can help you out. ;)

I am currently having some trouble with linking my DBgrid to my data control. At the moment, the data control is being populated by an encoded SQL query, so i can't link the DBgrid's datasource to the dataconrol in the properties window because the data control has no record source. As such I have tried to code this in, directly following the SQL statement that populates the data control's recordsource, using he following statement:

Set grdDataGrid.DataSource = datPrimaryRS

However, I get a data mismatch error and I am unclear why. Is this the right code? (grdDataGrid = my DBgrid and datPrimaryRS= my datacontrol) Secondly if I want to repopulate the DBgrid every time the user changes customers must I requery the data control or refresh the dbgrid?

Thank you,

There. Was that so hard? ;)

Instead of "Set grdDataGrid.DataSource = datPrimaryRS" try just "grdDataGrid.DataSource = datPrimaryRS"

It's been a while since I've done it, but I don't think you need to use Set.

~MtDew~
 

A.W.

Ars Tribunus Angusticlavius
6,790
Secondly if I want to repopulate the DBgrid every time the user changes customers must I requery the data control or refresh the dbgrid?

Oops, I missed this the first time.

AFAIK, changes that the user makes will be automatically updated, but if you want to see changes that other users have made (only applies if this is a multi-user database), you would have to re-query.

Again, it's been a while since I've used these controls (I prefer to do it the "hard" way, as it gives me more flexability), so I could be wrong.

~MtDew~
 
Status
Not open for further replies.