View Full Version : Refreshing a text box


StupidStudent
04-04-2007, 02:08 AM
Hi all

Does anyone know the VB code to update a text whenever a form is opened?

Thanks

:)

DrSnuggles
04-04-2007, 02:14 AM
Can you be more specific?

By the sounds of things you should set the focus to the text box and set the text. ie.
txtMyTextBox.setfocus
txtMyTextBox.text = "Text"

StupidStudent
04-04-2007, 02:29 AM
thanks for quick reply

What i am trying to do is

I have a query that counts how many records have been saved..

And I have a txtBox which recieves the value from that query

However as this txtBox is going towards making a primary key i need it to update every time the form is opened

Also does anyone know how i would set a value form a query to a int varible?

Thanks again

StupidStudent
04-04-2007, 02:50 AM
thanks for quick reply

What i am trying to do is

I have a query that counts how many records have been saved..

And I have a txtBox which recieves the value from that query

However as this txtBox is going towards making a primary key i need it to update every time the form is opened

Also does anyone know how i would set a value form a query to a int varible?

Thanks again

DrSnuggles
04-04-2007, 04:16 AM
What's wrong with this?:

txtMyTextBox.setfocus
txtMyTextBox.text = DCount("[Any Field Name Here"],[QueryNameHere]")

Look at CInt for Casting to Integers.