Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing the data of a form when changing the value of a combo box

Status
Not open for further replies.

Takieyda

IS-IT--Management
Jul 12, 2003
8
US
First, let me say I am sorry, because I am sure that this question has been posted a few times. I did search the forums but couldn't find anything that I could use.

Second, I am pretty new to Access. I can do some minor things, but no coding and no advanced macro and query functions.

The question:

I need to refresh the information displayed in a form when the value of a combo box is changed.
 
Create your combobox. Goto design view, click on the combobox and bring up its' property sheet (button at top with a hand holding a piece of paper). Click on the ALL tab and scroll to the top to see the Name option. Give it a name. For my example, I named Findit. Click on the Event Tab, click on the box next to AfterUpdate. Type:

Private Sub Findit_AfterUpdate
Dim R As Recordset
Set R = Me.RecordsetClone
R.FindFirst "[FieldID_in_table] = " & Me![Findit]
Me.BookMark = R.BookMark
End Sub

This will find the record with the field you selected.

Neil

 
No dice. I changed the name of the combo box and then changed is corresponding to the code and it errors:

Compile Error: Method or data member not found

Any ideas?
 
Change:
Dim R AS Recordset to
Dim R As DAO.Recordset

Then Click on Tools, References and make sure there's a check next to Microsoft DAO 3.6 Object Library and is in the third or fourth position from the top of the list.

Neil
 
Now I get a

run time error 3077: Syntax Error (Missing Operator)

in expression. and it debugs to the

R.FindFirst "[VIN] = " & Me![VIN] line of code.
 
Ok. First, don't make your combobox name the same as your field name. It's confusing. Go to Design view, click on the combobox and bring up its' property sheet. Click the All tab, scroll to the top and check the Name option. This name should be in the Me![XXXXX].
Is the field VIN anumeic or alpha? If it's numeric then
R.FindFirst "[VIN] = " & Me![XXXXX] is correct.

If it's alphabetic, then put
R.FindFirst "[VIN] = " & " & Me![VIN] & "

Neil
 
Here's a thread I started a good while back. The responses got me over the hump trying to do the same thing:
thread702-433303

--
JR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top