Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

After storing a new record is this record current on form/recordset? 1

Status
Not open for further replies.

smsmail

Programmer
Aug 11, 2010
105
US
Hello,

I have a form in which the user click the ADD button, the program insert the new record into recordset.

Is the new record, the current record in the recordset/form?

If not, how would I make it the current?

Thank you!
smsmail

 
No. If you build a query, lets say "qrySomeQuery" then when designing the form you set the recordsouce to the query. The form will open bound to the query. Access creates a dao recordset for the form. But you can do it at any time and change the recordsource.

...
Me.recordsource = "qrySomeOtherQuery"
or even
dim strSql as string
strSql = "Select * from someQuery where ID = " & someValue
me.recordsource = strSql


Now if you have to get the recordset from the form once bound
dim rs as dao.recordset
'this method returns only a dao rs
set rs = me.recordset


Why do you think you need to return the forms recordset? What types of things do you want to do?
 
MajP,

O.k. I got it "the form will open bound to the query"

So, then there is no need to create and open the recordset.
Makes sense!

Thanks so much for the mentoring, I very much appreciated it. I will make the changes in my program. More questions may be coming forth.

smsmail
 
Yep thats it. If you set the recordsource property all of the binding takes place for you. You can return the recordset of the form if you need to do some data manipulation behind the scenes. See Chapter 8 especially 450 to 480.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top