Hi all,

How to create refresh Button in the form? I have combo box with the
data linked to Access database. I create another form for data input for
those that appear on the combo box. When I close the input form, I
realise that the data is not yet appear on the combo box. I have to
close the first form, then open again. Then the data had included on the
combo box. Instead of doing this thing, I believe refresh button will
help a lot.

Any help please.

Thanks/shena

The best way in getting the data loaded to your combo box is to write a function and then call it every time you need to re-load the data "refresh data".

You will use something like -

Private Function LoadMyData()

Set rsLoadMyData = New ADODB.Recordset

rsLoadMyData.Open "SELECT MyChosenFieldToLoad FROM MyDataTable", conn, ....

Combo1.Clear

Do while rsLoadMyData.EOF = False
   combo1.AddItem rsLoadMyData!MyChosenFieldToLoad
   rsLoadMyData.MoveNext
Loop

End Sub

Under say a command button click event, you will have the following -

Call LoadMyData

frmInputData.Show

Unload Me

I hope this is what you were looking for.

Hey friend,

Yes, this is what i was looking for. The function works better. Thank you so much for your kind help.

Thanks/shena

Only a pleasure Shena

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.