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!

How do I clear a bounded form?

Status
Not open for further replies.

jbeggie

Programmer
Jun 30, 2005
5
US
My form is bound to a query. I want it to open to a blank form and to also clear whenever i click a clear button.

This is the line of code that I am using but to no avail.

DoCmd.GoToRecord , , acNewRec
 
That command will start a new record in the underlying tables of your query. When you say "clear" I'm not sure if that is what you need to do. I think your code should work unless your query is not updateable. If you just open your query in datasheet view is there a blank line at the bottom for a new record?
 
no. there is no lline there. This is what I did. I remove the query to use a table in stead. I can get the form to open to blank fields. How now do I get it to say move to the first record. I try the code below but it's doing nothing.
Me.Undo
DoCmd.GoToRecord , , acFirst
 
Best option is DON'T use bound controls, unless you are just doing prototyping and/or sample screens, and on this case you don't have to worry about clearing it anyway.



Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
I am using bound controls because I have a subform on the main form. Depending on the FirmID the subform is populated with the list of brands or products that are associated with that firm.
I first thought about using unbound forms and recordsets but I don't know how link the recordset too the subform.
If there is a way please let me know.
Thanks.
 
it is magic?
Frederico, have a look at the LinkMasterFields and LinkChildFields properties of the SubForm object ...
 
jbeggie,
Here are the Access forums in TEK-TIPS (FYI)
Microsoft: Access Forms Forum
Microsoft: Access Modules (VBA Coding) Forum
Microsoft: Access Queries and JET SQL Forum
Microsoft: Access Reports Forum
Microsoft: Access Tables and Relationships Forum
Microsoft: Access Other topics Forum
Microsoft: Access Project (ADP) Forum


________________________________________
Zameer Abdulla
Visit Me
A child may not be able to lift too much.
But it can certainly hold a marriage together
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top