Combo box is stuck!

G

Guest

Hello!

(I've been trying to get this form to work for months now)

My form is based on a query. The first box (combo box) has a list of school
districts. The rest of the boxes have the other information (address, phone,
etc.). I can scroll through all the records with the arrow at the bottom but
when I try and choose a specific district from the combo box...it won't click
and turn into the district I'm selecting! Did I explain that correctly? Any
ideas out there?

Gracias :)
 
G

Guest

What is in the After Update event of the combo box?
It doesn't happen automatically, you have to tell it to go to the record you
selected.
Here is an example:

Private Sub cboActivity_AfterUpdate()
Dim rst As Recordset
On Error GoTo cboActivity_AfterUpdate_Error

If Not IsNull(Me.cboActivity) Then
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & Me.cboActivity & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
End If
cboActivity_AfterUpdate_Exit:

On Error Resume Next
Exit Sub

cboActivity_AfterUpdate_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure cboActivity_AfterUpdate of VBA Document
Form_frmAttributetable"
GoTo cboActivity_AfterUpdate_Exit

End Sub
 
G

Guest

Thanks Klatuu (btw...I HAVE that album!).

I suppose I can't just copy and paste all that gobble d goop and paste it
into the event box? *sigh* They sure don't tell you stuff like this in the
Dummies books.

Back to lurking.....

Klatuu said:
What is in the After Update event of the combo box?
It doesn't happen automatically, you have to tell it to go to the record you
selected.
Here is an example:

Private Sub cboActivity_AfterUpdate()
Dim rst As Recordset
On Error GoTo cboActivity_AfterUpdate_Error

If Not IsNull(Me.cboActivity) Then
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & Me.cboActivity & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
End If
cboActivity_AfterUpdate_Exit:

On Error Resume Next
Exit Sub

cboActivity_AfterUpdate_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure cboActivity_AfterUpdate of VBA Document
Form_frmAttributetable"
GoTo cboActivity_AfterUpdate_Exit

End Sub


Jessica Murray said:
Hello!

(I've been trying to get this form to work for months now)

My form is based on a query. The first box (combo box) has a list of school
districts. The rest of the boxes have the other information (address, phone,
etc.). I can scroll through all the records with the arrow at the bottom but
when I try and choose a specific district from the combo box...it won't click
and turn into the district I'm selecting! Did I explain that correctly? Any
ideas out there?

Gracias :)
 
G

Guest

It's all secret stuff. We guard the knowledge very carefully so we can feel
like we are smarter than everyone else.
The dummy book is one of our evil conspiracies to make you feel unworthy.

Not exactly, what you would do is click on the button with the 3 dots on the
right of the event box, then select code builder. Now paste all that gobble
d goop except the first and last lines (Private Sub and End Sub) into the vba
editor. Now change this line
If Not IsNull(Me.cboActivity) Then
to the name of your combo box (cboActivity)

And this line
rst.FindFirst "[Activity] = '" & Me.cboActivity & "'"
[Activty] is the field where the matching data is for my combo, it needs to
be the field in your form's recordset that matches the data returned by your
combo.
Chage the cboActivity to your name.

Now, you have your own gooble d gook

Jessica Murray said:
Thanks Klatuu (btw...I HAVE that album!).

I suppose I can't just copy and paste all that gobble d goop and paste it
into the event box? *sigh* They sure don't tell you stuff like this in the
Dummies books.

Back to lurking.....

Klatuu said:
What is in the After Update event of the combo box?
It doesn't happen automatically, you have to tell it to go to the record you
selected.
Here is an example:

Private Sub cboActivity_AfterUpdate()
Dim rst As Recordset
On Error GoTo cboActivity_AfterUpdate_Error

If Not IsNull(Me.cboActivity) Then
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & Me.cboActivity & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
End If
cboActivity_AfterUpdate_Exit:

On Error Resume Next
Exit Sub

cboActivity_AfterUpdate_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure cboActivity_AfterUpdate of VBA Document
Form_frmAttributetable"
GoTo cboActivity_AfterUpdate_Exit

End Sub


Jessica Murray said:
Hello!

(I've been trying to get this form to work for months now)

My form is based on a query. The first box (combo box) has a list of school
districts. The rest of the boxes have the other information (address, phone,
etc.). I can scroll through all the records with the arrow at the bottom but
when I try and choose a specific district from the combo box...it won't click
and turn into the district I'm selecting! Did I explain that correctly? Any
ideas out there?

Gracias :)
 

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