Bound text box to datagrid or listbox

P

PETRP

I would appreciate anybody's help. I tried to find out solution also in
sample templates from Microsoft but they do not use this kind of linking.

I would like to browse records in datagrid (or in listbox in somecases) and
I would like to fill up all other objects on form according to currently
selected record in datagrid. What is best way to do it?

Thank you in advance.

Petr
 
B

Brendan Reynolds

Can't comment on the datagrid, but code similar to the following example
will work for a list box ...

Private Sub List4_AfterUpdate()

Me.Text0 = Me.List4.Column(0)
Me.Text2 = Me.List4.Column(1)

End Sub
 
W

Wayne-I-M

Create a list box and place this behind the AfterUpdate event

Private Sub ListBoxName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PrimaryFieldName] = " & Str(Nz(Me![ListBoxName], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Not really sure what Datagride is - can you given another word for this

--
Wayne
Manchester, England.
Enjoy whatever it is you do
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.
 
P

PETRP

Thank you for answer, I am going to try it.

I am sorry about Datagrid, this term is probably not known in Access... I
meant subform with initial view set as data list, so that you can see your
data in "Datagrid", similar like in Excel.

Petr



Wayne-I-M said:
Create a list box and place this behind the AfterUpdate event

Private Sub ListBoxName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PrimaryFieldName] = " & Str(Nz(Me![ListBoxName], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Not really sure what Datagride is - can you given another word for this

--
Wayne
Manchester, England.
Enjoy whatever it is you do
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.


PETRP said:
I would appreciate anybody's help. I tried to find out solution also in
sample templates from Microsoft but they do not use this kind of linking.

I would like to browse records in datagrid (or in listbox in somecases) and
I would like to fill up all other objects on form according to currently
selected record in datagrid. What is best way to do it?

Thank you in advance.

Petr
 
W

Wayne-I-M

If you are not sure about using access the best idea would be to use the
wizard to create a single form and then insert an unbound combo box.
Use the wizard to create the combo as well and select the option to find a
record on your form.

I think this will do what you are looking for.


--
Wayne
Manchester, England.
Enjoy whatever it is you do
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.


PETRP said:
Thank you for answer, I am going to try it.

I am sorry about Datagrid, this term is probably not known in Access... I
meant subform with initial view set as data list, so that you can see your
data in "Datagrid", similar like in Excel.

Petr



Wayne-I-M said:
Create a list box and place this behind the AfterUpdate event

Private Sub ListBoxName_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[PrimaryFieldName] = " & Str(Nz(Me![ListBoxName], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Not really sure what Datagride is - can you given another word for this

--
Wayne
Manchester, England.
Enjoy whatever it is you do
Scusate,ma il mio Inglese fa schiffo :)
Percio se non ci siamo capiti, mi mandate un
messagio e provero di spiegarmi meglio.


PETRP said:
I would appreciate anybody's help. I tried to find out solution also in
sample templates from Microsoft but they do not use this kind of linking.

I would like to browse records in datagrid (or in listbox in somecases) and
I would like to fill up all other objects on form according to currently
selected record in datagrid. What is best way to do it?

Thank you in advance.

Petr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top