Help with combo box settings

Mute

Registered User.
Local time
Today, 03:43
Joined
Aug 9, 2004
Messages
34
I have inserted a combo box into a form - this is set to find a record based on the value chosen.

This works as it shud do and displays the record when a value is chosen.

The problem i am having is that when i scroll thru the records using the navigation buttons everything changes as it shud do except the combo box value.

Can anyone help plz :confused: :confused: :confused: :confused:

Thanx in advance!!!!
 
Make sure that on the properties of the combo box: 'Control Source' is set to the bound column on your form.
 
If i do as u suggested i get an error message when i select from the list:

Error msg: Update or CancelUpdate without AddNew or Edit.

I then cannot exit the form as this msg keeps popping up.
 
Also when i go into design mode the combo box has "unbound" in it, could that b d problem?
 
What code do you have bound to your combobox and to what event(s)?
 
afterUpdate

code:

Private Sub Combo38_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[CustName] = '" & Me![Combo38] & "'"
Me.Bookmark = rs.Bookmark
End Sub

does dat make fings clearer?
 
Mute said:
Code:
Private Sub Combo38_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[CustName] = '" & Me![Combo38] & "'"
    Me.Bookmark = rs.Bookmark
End Sub

Let's tidy that up first:

Code:
Private Sub Combo38_AfterUpdate()

    On Error Goto Err_ErrorHandler

    ' Find the record that matches the control.
    Dim rs As DAO.Recordset
    Set rs = Me.RecordsetClone
    rs.FindFirst "[CustName] = """ & Me.[Combo38] & """"
    Me.Bookmark = rs.Bookmark

Exit_ErrorHandler:
    Set rs = Nothing
    Exit Sub
Err_ErrorHandler:
    MsgBox Err.Description, vbExclamation, "Error #" & Err.Number
    Resume Exit_ErrorHandler
End Sub

Now, on rereading your posts can I can see that you've created a search routine for your current recordset. Your combo is unbound and it works. I don't see the problem.

So the question is: why should the combobox value change? It's a search routine - it shouldn't hold any of your data.


does dat make fings clearer?

Please use English - this is not kindergarten.
 
Thank you,

My combox displays the name of the customer.

I want the user to be able to go directly to a customer by selecting a name on the combobox or they can scroll through the records using the navigation buttons.

I can get them to select the customer from the combobox without any problems but i cannot get the combobox to change as records are being scrolled through.

Maybe this is not possible? I am not sure but it would be desirable.

Thanks for the help you have given me so far.

PS. Sorry about my langauge - I am from the UK and we use SMS a lot which means I am so used to shortening words I sometimes do it without realising. I've read through this and am pretty sure everything is written in proper English. :)
 
Mute said:
I want the user to be able to go directly to a customer by selecting a name on the combobox or they can scroll through the records using the navigation buttons.

I can get them to select the customer from the combobox without any problems but i cannot get the combobox to change as records are being scrolled through.

You do realise how fast it flies through the records? And it goes to the first record it finds, you won't see it navigate through them all.

Sorry about my langauge - I am from the UK and we use SMS a lot which means I am so used to shortening words I sometimes do it without realising.

So am I. However, I know when to use a phone and when to use a keyboard. :p
 
I dont think you understood what I am trying to say.

I want the user to b able to scroll through the records and whilst doing so I want the combobox value to change accordingly.

PS, I thought you were American as people from the UK dont say Kindergarten :)
 
Hi Mute,

You need an afterupdate on the scroll that updates the combobox value with whatever is in the relevant field.
 
Hi,

Im very new to acess so id b grateful if u cud tell me how to do this plz.

Thank u :D
 
Private Sub Form_AfterUpdate()

cmbCustName.Refresh

End Sub

That would probably do it. Although without seeing the code I can't be sure.
 
Hi,

At the moment this is whats in the afterUpdate event of my combobox:

Private Sub Combo38_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[CustName] = '" & Me![Combo38] & "'"
Me.Bookmark = rs.Bookmark
End Sub

Where do i make the changes?
 
Mute said:
Private Sub Combo38_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[CustName] = '" & Me![Combo38] & "'"
Me.Bookmark = rs.Bookmark
End Sub

Why'd you revert to that mess?


I don't see why the combobox would scroll with record details - if you select a value in a combobox in order to find the appropriate record and then navigate to that record, the combobox should already have the details you want.
 
hey

that code was i posted was compiled by access - i didnt change it but i will do if u think it will help.

Im stil stuck though and Im at my wits end with this.

I want the user to be able to choose within the same form how they want to navigate through the records.

if they know who they r looking for then they can select the name from the combobox but if they dont know who they are looking for then they are able to use the navigation buttons to scroll through the records.

They can do this at the moment but i want the combobox value to change according to the record when the navigation buttons are used.

There must b a way of doing this sumhow.
 
Mute said:
if they know who they r looking for then they can select the name from the combobox but if they dont know who they are looking for then they are able to use the navigation buttons to scroll through the records.

They can do this at the moment but i want the combobox value to change according to the record when the navigation buttons are used.

Ah! Much clearer now.

Use the form's Current event to set the combobox value to whatever you want.
 
Im gonna look really stupid now (if i didnt already) but i dont know how to do this :(

I want the combobox value to be custname (ie customer name) how would i do this.

PS, im glad you know what im talking about now :)
 
Since I don't know what your table structure is like, I'll apply explicit values.

Code:
Private Sub Form_Current()
    If Not Me.NewRecord Then
        Me.MyCombo = Me.txtMyTextBox
    End If
End Sub

Personally, my first column of a combo would be an autonumber that I'd have to get by referring to a hidden textbox bound to the CustomerID field.
 

Users who are viewing this thread

Back
Top Bottom