Text box to combo box to change record in form

F

FA

I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
D

Dennis

Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark
 
F

FA

In the after update event?

Dennis said:
Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

FA said:
I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
D

Dennis

Sorry, yes the After_Update event

FA said:
In the after update event?

Dennis said:
Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

FA said:
I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
F

FA

What should I write on the [ComboField]?

Dennis said:
Sorry, yes the After_Update event

FA said:
In the after update event?

Dennis said:
Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

:

I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
D

Dennis

Its the actual Name of the combo box field on your form

FA said:
What should I write on the [ComboField]?

Dennis said:
Sorry, yes the After_Update event

FA said:
In the after update event?

:

Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

:

I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
F

FA

This is what I have:

Private Sub Nombre_de_organización_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Nombre de organización] = '" & Me![Nombre de organización] &
"'"
Me.Bookmark = rs.Bookmark

End Sub

The comboField appears to have the same name as the Table field (I think it
was created automatically when I change the text box to a combo box field).

What I'm doing wrong?

Dennis said:
Its the actual Name of the combo box field on your form

FA said:
What should I write on the [ComboField]?

Dennis said:
Sorry, yes the After_Update event

:

In the after update event?

:

Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

:

I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
D

Dennis

Your combo box should be displaying the unique field that identifies each
different record in your table e.g. Organizacion_ID (assuming this is a text
field)
your code should then look like this

Private Sub Nombre_de_organización_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Organización_ID] = '" & Me![Nombre de organización] & "'"
Me.Bookmark = rs.Bookmark

FA said:
This is what I have:

Private Sub Nombre_de_organización_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Nombre de organización] = '" & Me![Nombre de organización] &
"'"
Me.Bookmark = rs.Bookmark

End Sub

The comboField appears to have the same name as the Table field (I think it
was created automatically when I change the text box to a combo box field).

What I'm doing wrong?

Dennis said:
Its the actual Name of the combo box field on your form

FA said:
What should I write on the [ComboField]?

:

Sorry, yes the After_Update event

:

In the after update event?

:

Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

:

I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
D

Dennis

I think the problem is that the original field is mapped to your underlying
table and simply changing it to a combo box will not alter this. I think what
you need is a combo box that is not mapped to an underlying field, but is
used to navigate to the record you want. If this is the case I suggest you
add a new combo box to your form and the wizard has the options you require
to navigate to the record based on your selection.

FA said:
This is what I have:

Private Sub Nombre_de_organización_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Nombre de organización] = '" & Me![Nombre de organización] &
"'"
Me.Bookmark = rs.Bookmark

End Sub

The comboField appears to have the same name as the Table field (I think it
was created automatically when I change the text box to a combo box field).

What I'm doing wrong?

Dennis said:
Its the actual Name of the combo box field on your form

FA said:
What should I write on the [ComboField]?

:

Sorry, yes the After_Update event

:

In the after update event?

:

Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

:

I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
B

Beetle

What are you trying to do? Are you just trying to search for a particular
record, are do you want to actually manipulate (change) data in the
underlying table?

--
_________

Sean Bailey


FA said:
This is what I have:

Private Sub Nombre_de_organización_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Nombre de organización] = '" & Me![Nombre de organización] &
"'"
Me.Bookmark = rs.Bookmark

End Sub

The comboField appears to have the same name as the Table field (I think it
was created automatically when I change the text box to a combo box field).

What I'm doing wrong?

Dennis said:
Its the actual Name of the combo box field on your form

FA said:
What should I write on the [ComboField]?

:

Sorry, yes the After_Update event

:

In the after update event?

:

Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

:

I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
F

FA

I have an ID but I want the combo to have the Names. I added the ID to the
select query in the row source but nothing is happening.

Dennis said:
Your combo box should be displaying the unique field that identifies each
different record in your table e.g. Organizacion_ID (assuming this is a text
field)
your code should then look like this

Private Sub Nombre_de_organización_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Organización_ID] = '" & Me![Nombre de organización] & "'"
Me.Bookmark = rs.Bookmark

FA said:
This is what I have:

Private Sub Nombre_de_organización_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Nombre de organización] = '" & Me![Nombre de organización] &
"'"
Me.Bookmark = rs.Bookmark

End Sub

The comboField appears to have the same name as the Table field (I think it
was created automatically when I change the text box to a combo box field).

What I'm doing wrong?

Dennis said:
Its the actual Name of the combo box field on your form

:

What should I write on the [ComboField]?

:

Sorry, yes the After_Update event

:

In the after update event?

:

Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

:

I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
F

FA

I want to search for particular records.

Beetle said:
What are you trying to do? Are you just trying to search for a particular
record, are do you want to actually manipulate (change) data in the
underlying table?

--
_________

Sean Bailey


FA said:
This is what I have:

Private Sub Nombre_de_organización_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Nombre de organización] = '" & Me![Nombre de organización] &
"'"
Me.Bookmark = rs.Bookmark

End Sub

The comboField appears to have the same name as the Table field (I think it
was created automatically when I change the text box to a combo box field).

What I'm doing wrong?

Dennis said:
Its the actual Name of the combo box field on your form

:

What should I write on the [ComboField]?

:

Sorry, yes the After_Update event

:

In the after update event?

:

Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

:

I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
B

Beetle

Then, as Dennis mentioned, your combo box should be unbound (nothing
in it's control source). It would typically be placed in the header of the
form, and it should also have properties like the following;

Row Source - "Select OrganizationID, OrganizationName From tblOrganizations
OrderBy OrganizationName"
Bound Column - 1
Column Count - 2
Column Widths - 0",2" (or whatever works best for the second column)

This way, the organization ID will be in the combo box so you can search
on it, but it will not be displayed to the users. The code Dennis provided
should work, but if the OrganizationID in an integer (number), then you will
want
to remove the single quotes like;

Set rs = Me.Recordset.Clone
rs.FindFirst "[OrganizationID] = " & Me![OrganizationID]
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
End If

--
_________

Sean Bailey


FA said:
I want to search for particular records.

Beetle said:
What are you trying to do? Are you just trying to search for a particular
record, are do you want to actually manipulate (change) data in the
underlying table?

--
_________

Sean Bailey


FA said:
This is what I have:

Private Sub Nombre_de_organización_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Nombre de organización] = '" & Me![Nombre de organización] &
"'"
Me.Bookmark = rs.Bookmark

End Sub

The comboField appears to have the same name as the Table field (I think it
was created automatically when I change the text box to a combo box field).

What I'm doing wrong?

:

Its the actual Name of the combo box field on your form

:

What should I write on the [ComboField]?

:

Sorry, yes the After_Update event

:

In the after update event?

:

Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

:

I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
F

FA

Thank you very much! The thing is that this code changes only the
subdatasheet and not the record in the form itself. I want both to change.
How can I do this?

FA

Beetle said:
Then, as Dennis mentioned, your combo box should be unbound (nothing
in it's control source). It would typically be placed in the header of the
form, and it should also have properties like the following;

Row Source - "Select OrganizationID, OrganizationName From tblOrganizations
OrderBy OrganizationName"
Bound Column - 1
Column Count - 2
Column Widths - 0",2" (or whatever works best for the second column)

This way, the organization ID will be in the combo box so you can search
on it, but it will not be displayed to the users. The code Dennis provided
should work, but if the OrganizationID in an integer (number), then you will
want
to remove the single quotes like;

Set rs = Me.Recordset.Clone
rs.FindFirst "[OrganizationID] = " & Me![OrganizationID]
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
End If

--
_________

Sean Bailey


FA said:
I want to search for particular records.

Beetle said:
What are you trying to do? Are you just trying to search for a particular
record, are do you want to actually manipulate (change) data in the
underlying table?

--
_________

Sean Bailey


:

This is what I have:

Private Sub Nombre_de_organización_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Nombre de organización] = '" & Me![Nombre de organización] &
"'"
Me.Bookmark = rs.Bookmark

End Sub

The comboField appears to have the same name as the Table field (I think it
was created automatically when I change the text box to a combo box field).

What I'm doing wrong?

:

Its the actual Name of the combo box field on your form

:

What should I write on the [ComboField]?

:

Sorry, yes the After_Update event

:

In the after update event?

:

Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

:

I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
B

Beetle

Well, I'm a little unclear about what you're trying to do. I assume when you
say subdatasheet you mean a subform in datasheet view. Is the combo box
in the subform?

Typically, a main form would have a different recordsource than it's subform,
so you can't manipulate both with the same RecordsetClone. Maybe you
could provide more details about what you are trying to do. It will be
helpful if you can provide the relevant form names and record sources.

--
_________

Sean Bailey


FA said:
Thank you very much! The thing is that this code changes only the
subdatasheet and not the record in the form itself. I want both to change.
How can I do this?

FA

Beetle said:
Then, as Dennis mentioned, your combo box should be unbound (nothing
in it's control source). It would typically be placed in the header of the
form, and it should also have properties like the following;

Row Source - "Select OrganizationID, OrganizationName From tblOrganizations
OrderBy OrganizationName"
Bound Column - 1
Column Count - 2
Column Widths - 0",2" (or whatever works best for the second column)

This way, the organization ID will be in the combo box so you can search
on it, but it will not be displayed to the users. The code Dennis provided
should work, but if the OrganizationID in an integer (number), then you will
want
to remove the single quotes like;

Set rs = Me.Recordset.Clone
rs.FindFirst "[OrganizationID] = " & Me![OrganizationID]
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
End If

--
_________

Sean Bailey


FA said:
I want to search for particular records.

:

What are you trying to do? Are you just trying to search for a particular
record, are do you want to actually manipulate (change) data in the
underlying table?

--
_________

Sean Bailey


:

This is what I have:

Private Sub Nombre_de_organización_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Nombre de organización] = '" & Me![Nombre de organización] &
"'"
Me.Bookmark = rs.Bookmark

End Sub

The comboField appears to have the same name as the Table field (I think it
was created automatically when I change the text box to a combo box field).

What I'm doing wrong?

:

Its the actual Name of the combo box field on your form

:

What should I write on the [ComboField]?

:

Sorry, yes the After_Update event

:

In the after update event?

:

Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

:

I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 
F

FA

I created a form from TblData_Organization. I added a subform from
TblData_Reports. I added the combo box to control both, the data from
Organizations and the reports they submit. The code that you provided
changes the organization in TblData_Reports but not the TblData_Organization.


Beetle said:
Well, I'm a little unclear about what you're trying to do. I assume when you
say subdatasheet you mean a subform in datasheet view. Is the combo box
in the subform?

Typically, a main form would have a different recordsource than it's subform,
so you can't manipulate both with the same RecordsetClone. Maybe you
could provide more details about what you are trying to do. It will be
helpful if you can provide the relevant form names and record sources.

--
_________

Sean Bailey


FA said:
Thank you very much! The thing is that this code changes only the
subdatasheet and not the record in the form itself. I want both to change.
How can I do this?

FA

Beetle said:
Then, as Dennis mentioned, your combo box should be unbound (nothing
in it's control source). It would typically be placed in the header of the
form, and it should also have properties like the following;

Row Source - "Select OrganizationID, OrganizationName From tblOrganizations
OrderBy OrganizationName"
Bound Column - 1
Column Count - 2
Column Widths - 0",2" (or whatever works best for the second column)

This way, the organization ID will be in the combo box so you can search
on it, but it will not be displayed to the users. The code Dennis provided
should work, but if the OrganizationID in an integer (number), then you will
want
to remove the single quotes like;

Set rs = Me.Recordset.Clone
rs.FindFirst "[OrganizationID] = " & Me![OrganizationID]
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
End If

--
_________

Sean Bailey


:

I want to search for particular records.

:

What are you trying to do? Are you just trying to search for a particular
record, are do you want to actually manipulate (change) data in the
underlying table?

--
_________

Sean Bailey


:

This is what I have:

Private Sub Nombre_de_organización_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Nombre de organización] = '" & Me![Nombre de organización] &
"'"
Me.Bookmark = rs.Bookmark

End Sub

The comboField appears to have the same name as the Table field (I think it
was created automatically when I change the text box to a combo box field).

What I'm doing wrong?

:

Its the actual Name of the combo box field on your form

:

What should I write on the [ComboField]?

:

Sorry, yes the After_Update event

:

In the after update event?

:

Dim rs As Object

Set rs = Me.Recordset.Clone
' if a text field use this
rs.FindFirst "[YourTableFieldName] = '" & Me![ComboField] & "'"
' if a numeric field use this
rs.FindFirst "[YourTableFieldName] = " & Me![ComboField]
Me.Bookmark = rs.Bookmark

:

I made a form using the wizard and as usual everything was entered as text
boxes. I want to change one of them to a combo box. I used the 'right
click'-'change to' feature
I populated the list with a select query on the row source property. My
problem is that the record on the form does not change. How
can I make this combo box to select the record on the form?

Thanks,

FA
 

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