Log in

View Full Version : Newbie Question - That Simple Can;t find answer.



dizzyegg
11-28-2007, 10:40 AM
Hi all,

Im very new to access, let along VBA. I have built my database and have done nearly everything I needed but VBA.

Now im no programmer, so this VBA really confuses me. I have searched online but really dont know what im looking for.

I have built a query for something that I need to work on my form. The Query takes the required information off the form and this works well.

What I need is a button on my form that will open this query take the data from the last field on the only record there and put it into a textbox on my form. I think that this is that simple that it's not on any form, I have been searchin google now for like nearly 2 hours.

I would also like to learn a little bit of VBA, so if anyone knows a good place to start too.

Thanks

dannot
11-29-2007, 01:43 AM
at a high level the text box is for you to enter data a list box receives data

if the data is in a table then map the control source to a query finding you the one value

create a command button and open the on click code and type Me.refresh

should do the trick

Dan

DarkSprout
11-29-2007, 06:55 AM
Returns Last AutoNumber from Table/Query
With Criteria:
[TextBoxName] = DLast("anFieldID", "qry_QueryName", "[SearchField] = " & nCriteria)

Very Last Record:
[TextBoxName] = DLast("anFieldID", "qry_QueryName", "[anFieldID] > 0 ")