Open Form New Record

Raven

Soozie's watchin' you!
Local time
Today, 16:29
Joined
May 1, 2002
Messages
48
I have main form wiv button that opens new keyword form.

I would like to have new keyword form open on a new record in order that user can input new data.

I know all you 'experts' out there will find this a very simple one.. ! I suspect it's a one line piece of code in the code on the button on the main form, which currently looks like:

Private Sub cmdaddkeyword_Click()
On Error GoTo Err_cmdaddkeyword_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmaddkeywords"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdaddkeyword_Click:
Exit Sub

Err_cmdaddkeyword_Click:
MsgBox Err.Description
Resume Exit_cmdaddkeyword_Click

End Sub
 
set the frmaddkeywords DataEntry property to "Yes"

Col
 
ColinEssex said:
set the frmaddkeywords DataEntry property to "Yes"

Col

Col is that better than DoCmd.GoToRecord , , acNewRec ?
 
BarryMK said:
Col is that better than DoCmd.GoToRecord , , acNewRec ?

Thanks Barry I'ved used your code, it works really well! :)

Only thing is when I return to the original form, the combo box that is looking up the table that has just had information added to it is not updated, ie I have to close the form to refresh it so to speak... can you advise how to refresh the form and where the code should be placed, should I use me.refresh and if so where?

Thanks for your advice :D
 
What I would do is to minimize the main form when opening your new one. Then on the On Close event of the new form restore the original.
Something like this:

Dim stDocName As String
Dim stLinkCriteria As String
'minimise first form

DoCmd.Minimize acForm, "Your Main form name here"
'open second form

stDocName = "Your new form name here"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Then on the On Close event of your new form Restore the first:


DoCmd.Restore stDocName, , , stLinkCriteria

stDocName = "Your Main form name here"
 
Hmmm Barry,

I thought this was a little complicated, so I tried Me.Refresh in various events and it working in the onmousedown event of the combo box on the original form :D

Seems to do the job!
 
Raven said:
Hmmm Barry,

I thought this was a little complicated, so I tried Me.Refresh in various events and it working in the onmousedown event of the combo box on the original form :D

Seems to do the job!

It's quite easy really and has the advantage of hiding one form while using another but if your solution works for you that's what matters. :)
 

Users who are viewing this thread

Back
Top Bottom