ComboBox Tied to Access Data Connection Table

Printmark

New Member
Joined
Jan 22, 2010
Messages
7
Here is my issue...

I have ComboBox that has the listfillrange pointed at a range that is filled via Access Data Connection (customer database) which is imported into excel as a table when opening the workbook. I then have it bound to cell G7 which fills with the value of the ComboBox. The ComboBox simply works as a customer search box and enters the value in g7. From there I use "vlookups", based on the value in g7, to complete the rest of the contact information in my excel worksheet.

I then have a command button to "Edit Current Customer" which when clicked uses the value in g7 to open an Access Form filled with the selected customers data. I make my changes, then click a "save and return" button to go back to excel.

Once back in excel I have a "lost focus" macro on the command button to refresh the Access Database in Excel. This works good but the problem I have is that when the Excel Table is refreshed, the value of the ComboBox changes, which is very annoying, because you then have to "re find" the customer you just edited.

My question is, how do I keep the value of the ComboBox or G7 from changing after the table is refreshed?

This is what I have tried.. seems like it should work, but it doesn't.

Code:
Private Sub btnEditSpCust_LostFocus()
    Dim LCategoryID As String
    LCategoryID = Range("g7").Value
    ActiveWorkbook.Connections("Customer Contact DB").Refresh
    ActiveWorkbook.Sheets(1).Range("g7") = LCategoryID
End Sub

Thanks for any ideas!
Mark
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,224,594
Messages
6,179,794
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top