Combo Box

  • Thread starter ArmySGT via AccessMonster.com
  • Start date
A

ArmySGT via AccessMonster.com

I want to sync my form with my combo box so when I scroll through the combo
box the data in the form also changes and visa versa.

I saw this somewhere in the forums but now I can not locate it for the life
of me.

Does anyone remember or know where it is posted?

Thank you ahead of time!
 
L

Linq Adams via AccessMonster.com

Hey, Sarge! You can do the combobx using the Wizard:

First, if you haven't already done so, create a form based on your
query/table, including all the fields you want displayed. Then simply:

Add a combo box to your form. The Combobox Wizard will pop up

Select "Find a record based on the value I selected in my combobox."

From the query/table the form is based on, click on the ***unique*** field
you're searching by (an ID field, for instance) to move it to the right side.

Hit Next.

Size the column appropriately.

Hit Next.

Name the combobox.

Hit Finish.

Now you can drop the combobox down and scroll down to the item to search by,
or you can start to enter the item, and the combobox will "autofill" as you
type. Hit <Enter> and the record will be retrieved.

To make the combobox reflect the record, when moving from record to record,
you'll need code like this:

Private Sub Form_Current()
If Not Me.NewRecord Then
Me.ComboBox = Me.UniqueField
End If
End Sub

replacing ComboBox with the actual name of your combobox, and replacing
UniqueField with the actual name of your unique field that is used to
retrieve the record in the combobox.
 
A

ArmySGT via AccessMonster.com

Thanks for the quick reply, I am not so good at Access, where does that code
go in at?

This is the current code. It is hard for me to do this because I have to do
everything manual as the database is in JWICS

Option Compare Database

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

Set rs = Me.Recordset.Clone
rs.FindFirst "[Last] = '" & Me![Combo16] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
 
A

ArmySGT via AccessMonster.com

Ya I noticed I did that, my apalogizes I attempted to edit or delete but
couldnt find where to edit or delete posts.

Is this function not here?
Please don't cross post. You question has been answered in another group.
Thanks for the quick reply, I am not so good at Access, where does that code
go in at?
[quoted text clipped - 12 lines]
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
 
K

Klatuu

No, not really.
No big deal, but the problem is you will find some people who will not even
respond to multi posters.
--
Dave Hargis, Microsoft Access MVP


ArmySGT via AccessMonster.com said:
Ya I noticed I did that, my apalogizes I attempted to edit or delete but
couldnt find where to edit or delete posts.

Is this function not here?
Please don't cross post. You question has been answered in another group.
Thanks for the quick reply, I am not so good at Access, where does that code
go in at?
[quoted text clipped - 12 lines]
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
 
A

ArmySGT via AccessMonster.com

Ya I find this a HUGE help, I was awe struck to stroll across something like
this. I am not an access wiz or even pretend to be, but I am trying to make
a little database to handle my workload a bit better.

I have about 730 military personell in every branch that I support so this is
helping me immensely but I am having so many troubles with this combo box not
doing what I would love for it to do.

And I do not understand this visual basic code thing, people say use this but
I dont know if you add to what is there, take away, what to leave etc. I end
up trying many things.

And to top that off I cant cut and paste or print, I am using this on a
TopSecret sytem so I input it all by hand ><

By the way, your last post on my last post, I am confused. Not sure where
the codes go ><

Sorry.
No, not really.
No big deal, but the problem is you will find some people who will not even
respond to multi posters.
Ya I noticed I did that, my apalogizes I attempted to edit or delete but
couldnt find where to edit or delete posts.
[quoted text clipped - 7 lines]
 
K

Klatuu

I would be happy to help, but I can't find the other post now. Could you go
back to that one and ask the question from there, please.
--
Dave Hargis, Microsoft Access MVP


ArmySGT via AccessMonster.com said:
Ya I find this a HUGE help, I was awe struck to stroll across something like
this. I am not an access wiz or even pretend to be, but I am trying to make
a little database to handle my workload a bit better.

I have about 730 military personell in every branch that I support so this is
helping me immensely but I am having so many troubles with this combo box not
doing what I would love for it to do.

And I do not understand this visual basic code thing, people say use this but
I dont know if you add to what is there, take away, what to leave etc. I end
up trying many things.

And to top that off I cant cut and paste or print, I am using this on a
TopSecret sytem so I input it all by hand ><

By the way, your last post on my last post, I am confused. Not sure where
the codes go ><

Sorry.
No, not really.
No big deal, but the problem is you will find some people who will not even
respond to multi posters.
Ya I noticed I did that, my apalogizes I attempted to edit or delete but
couldnt find where to edit or delete posts.
[quoted text clipped - 7 lines]
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
 
Top