954,582 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Refresh a form

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

shena
Junior Poster in Training
57 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

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.

AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
 

Hey friend,

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

Thanks/shena

shena
Junior Poster in Training
57 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

Only a pleasure Shena

AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You