Opening a blank form

samash1

Registered User.
Local time
Today, 23:01
Joined
Nov 3, 2008
Messages
14
Hi all,

I need some help with a database that im working on.
I have a table that I am opening using a form but when i open the form I want it to display a blank form so that I can input new data and not just show the current data. Any advice would be very welcome

Thanks
Sam
 
Hi all,

I need some help with a database that im working on.
I have a table that I am opening using a form but when i open the form I want it to display a blank form so that I can input new data and not just show the current data. Any advice would be very welcome

Thanks
Sam

Using VBA, this code will open a form and start in the first field of thenext new record:
Code:
[FONT=Times New Roman][SIZE=3]  DoCmd.OpenForm "[B]{[COLOR=red]YourForm[/COLOR]}[/B]", acNormal[/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman]  DoCmd.GoToRecord , , acNewRec[/FONT][/SIZE] 
[SIZE=3][FONT=Times New Roman]  [Forms]![[B]{[COLOR=red]YourForm[/COLOR]}[/B]].Form.[B]{[COLOR=red]FirstControl[/COLOR]}[/B].SetFocus[/FONT][/SIZE]
 
If you are not opening the form from another form (i.e., just double-clicking the form to open it), then you will need to set the following to the forms OnCurrent event.

Code:
DoCmd.GoToRecord, , acNewRec

-dK
 
No it is from a control form
Im gonna try that code
Thanks
 
I wont accept the last line of code, it gives an invalid character warning on the commas
I am using 07 if that makes any difference
 
I wont accept the last line of code, it gives an invalid character warning on the commas
I am using 07 if that makes any difference

I assume that you are aware that the "{" and "}" should be ignored, and that YourForm and FirstControl need to be replaced with your own values. Please post the text of your code in the reply for us to look at.
 
Yes but it still wouldnt work i think it may have somthing to do with my permission settings
It dosnt matter now ive figured out how to do it, it was just a setting in the properties window
Thanks for your help anyways
Sam
 
The only setting in the Properties Window that will do this is Date Entry set to Yes. This will open with a new record, but with this setting you can only add new records, you cannot view existing records. If this suits your needs, that approach is fine. But if you also want to be able to view existing records, you need to use something like this:

Code:
Private Sub Form_Load()
 DoCmd.GoToRecord , , acNewRec
End Sub

I believe dk misspoke when he said to place this line in the form's OnCurrent event; that would result in you being moved to a new record anytime you tried to move to any record, including an existing record.
 
Agreed Linq, but it wasn't a misspeaking - I was just flat out wrong. Thanks for being nice. :D

I just went back to double-check my post after I saw user having problems. Ignored it initially since samash1 was opening from another form.


-dK
 
Thanks for this, I was also trying to work this one out :)

Ruth
 
Kudos to you, Ruth! It's nice to see someone who actually searches for the answer before posting a thread! ;)
 
I do try .... makes me look less like a fool when being told "its been answered here and here and here before" lol :)
 

Users who are viewing this thread

Back
Top Bottom