Question Refresh Form Data

anonamux

New member
Local time
Today, 03:12
Joined
May 8, 2012
Messages
5
Hello, I am working on a Purchase Order database in Access 2010 for a small company.

I have a purchase order form which gets data from the vendor table.

So when a user selects a vendor from the combo box, I want the corresponding information (vendor phone #, address, etc.) to display in the text box below in-case it needs to be edited by the user.

I can get it to display the correct information by creating a macro that closes the form and re-opens it, but then I have to cycle through all the records to get back to the one I was working on. Tried using "GoToPage: Last" in the macro builder but it will not cooperate.

Any help is greatly appreciated!
 
Read up on me.requery

You would want to use it in the after update event of your combo box.

Chris
 
I thought that my record source is already a query that gets data from the vendor table, otherwise how would it get that data?

Like so:

SELECT [Purchase Orders].*, Vendors.[Contact Name], Vendors.[Contact Name], Vendors.[Vendor Name], Vendors.Address, Vendors.City, Vendors.[Zip Code], Vendors.[State/Province], Vendors.Phone FROM Vendors INNER JOIN [Purchase Orders] ON Vendors.VendorID = [Purchase Orders].Vendor.Value;


I tried in VB on the After Update of the combo box:

Me.Requery <-- Error
Me.Vendor.Requery <-- nothing happens
Me.Requery = Me.Requery <-- Crashes

I read up a little on Me.Requery and DoCmd.Requery, am I doing this wrong?

I just want it to update the Vendors.[Contact Name], Vendors.[Address],Vendors.[City], Vendors.[Zip Code], Vendors.[State/Province], Vendors.[Phone] text boxes.

Would RefreshSharePointList be a viable option? that refreshes the data that is shared on the form correct?
 
Last edited:
"Make sure that the combo is bound to the correct column."

Does that mean the Row Source of the combo box?

SELECT [Vendors].[VendorID], [Vendors].[Vendor Name] FROM Vendors ORDER BY [Vendor Name];

"Vendors" is the name of the table... so I mean that should be right. I deleted all the macros and requery bits in VB. Still not populating though.

Thanks for being so helpful by the way.
 
Ahah! my Control Source was "Vendor" when the table name is "Vendors" so I changed it so it now reads "=[Vendors]"

This may have fixed it, but now upon clicking any of the drop down choices nothing happens, is this because my OnClick Event is blank?


Private Sub Vendor_Click()


End Sub

(Vendor is the name of the combo box)

I suppose from now on I should start tables with "tbl" and forms with "frm" as a good practice eh?
 
The = doesn't make a difference, still not clickable. Still not populating fields.
 

Users who are viewing this thread

Back
Top Bottom