Connecting Tech Pros Worldwide Forums | Help | Site Map

Control on Continuous Form

ladybug via AccessMonster.com
Guest
 
Posts: n/a
#1: Aug 22 '07
I have a table that has three fields. First is date, Second is a text field,
the third is a number.

I want to create a form where the date is entered at the top and then the
text field and number field is a continuous form below. I want to be able to
enter in numerous entries under that date without having to enter the date
each time. Can someone help me through the steps in setting this up?

I had the date in the header and then the text and number field in the detail
set to continuous. However, when I enter in the date and then enter the
other two fields when I hit tab it clears out the date.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200708/1


Phil Stanton
Guest
 
Posts: n/a
#2: Aug 23 '07

re: Control on Continuous Form


On the main form have an unbound textbox called DateEnter

On the Subform have the DateField called say DateEvent

Then you need this bit of code on the BeforeInsert Event on the subform.
(You might consider setting the DefautValue of DateEvent = Date() to set
today's date)

Option Compare Database
Option Explicit

Private Sub Form_BeforeInsert(Cancel As Integer)

If IsNull(DateEvent) Then
If Not IsDate(Me.Parent!DateEnter) Then
MsgBox "There is no date on the top of the form", vbInformation
Cancel = True
Exit Sub
Else
DateEvent = Me.Parent!DateEnter
End If
End If

End Sub

HTH

Phil

"ladybug via AccessMonster.com" <u21071@uwewrote in message
news:7717a95b5de31@uwe...
Quote:
>I have a table that has three fields. First is date, Second is a text
>field,
the third is a number.
>
I want to create a form where the date is entered at the top and then the
text field and number field is a continuous form below. I want to be able
to
enter in numerous entries under that date without having to enter the date
each time. Can someone help me through the steps in setting this up?
>
I had the date in the header and then the text and number field in the
detail
set to continuous. However, when I enter in the date and then enter the
other two fields when I hit tab it clears out the date.
>
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200708/1
>

plum.is.caejwp@gmail.com
Guest
 
Posts: n/a
#3: Aug 23 '07

re: Control on Continuous Form


On Aug 23, 7:06 am, "ladybug via AccessMonster.com" <u21071@uwe>
wrote:
Quote:
I have a table that has three fields. First is date, Second is a text field,
the third is a number.
>
I want to create a form where the date is entered at the top and then the
text field and number field is a continuous form below. I want to be able to
enter in numerous entries under that date without having to enter the date
each time. Can someone help me through the steps in setting this up?
>
I had the date in the header and then the text and number field in the detail
set to continuous. However, when I enter in the date and then enter the
other two fields when I hit tab it clears out the date.
>
--
Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/2007...

ladybug via AccessMonster.com
Guest
 
Posts: n/a
#4: Aug 23 '07

re: Control on Continuous Form


How do I create a subform when the only other data on the main form is an
unbound text field?

Phil Stanton wrote:
Quote:
>On the main form have an unbound textbox called DateEnter
>
>On the Subform have the DateField called say DateEvent
>
>Then you need this bit of code on the BeforeInsert Event on the subform.
>(You might consider setting the DefautValue of DateEvent = Date() to set
>today's date)
>
>Option Compare Database
>Option Explicit
>
>Private Sub Form_BeforeInsert(Cancel As Integer)
>
If IsNull(DateEvent) Then
If Not IsDate(Me.Parent!DateEnter) Then
MsgBox "There is no date on the top of the form", vbInformation
Cancel = True
Exit Sub
Else
DateEvent = Me.Parent!DateEnter
End If
End If
>
>End Sub
>
>HTH
>
>Phil
>
Quote:
>>I have a table that has three fields. First is date, Second is a text
>>field,
>[quoted text clipped - 10 lines]
Quote:
>set to continuous. However, when I enter in the date and then enter the
>other two fields when I hit tab it clears out the date.
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200708/1

ladybug via AccessMonster.com
Guest
 
Posts: n/a
#5: Aug 23 '07

re: Control on Continuous Form


Ok, please disregard my last posting. I talked before I thought. :)

I did what you said and now I am getting this error:
The expression BeforeInsert you entered as the event property setting
produced the following error: Ambiguous name detected: Form_BeforeInsert.

Phil Stanton wrote:
Quote:
>On the main form have an unbound textbox called DateEnter
>
>On the Subform have the DateField called say DateEvent
>
>Then you need this bit of code on the BeforeInsert Event on the subform.
>(You might consider setting the DefautValue of DateEvent = Date() to set
>today's date)
>
>Option Compare Database
>Option Explicit
>
>Private Sub Form_BeforeInsert(Cancel As Integer)
>
If IsNull(DateEvent) Then
If Not IsDate(Me.Parent!DateEnter) Then
MsgBox "There is no date on the top of the form", vbInformation
Cancel = True
Exit Sub
Else
DateEvent = Me.Parent!DateEnter
End If
End If
>
>End Sub
>
>HTH
>
>Phil
>
Quote:
>>I have a table that has three fields. First is date, Second is a text
>>field,
>[quoted text clipped - 10 lines]
Quote:
>set to continuous. However, when I enter in the date and then enter the
>other two fields when I hit tab it clears out the date.
--
Message posted via http://www.accessmonster.com

Phil Stanton
Guest
 
Posts: n/a
#6: Aug 23 '07

re: Control on Continuous Form


Odd.

The BeforInsert shoul only be on the subform. There should be no code on the
main form

Can you select ALL the code on the subform, copy it into your reply and post
it to the NewsGroup I guess there may be a difference in the names of the
controls

Phil


"ladybug via AccessMonster.com" <u21071@uwewrote in message
news:7721524c3d967@uwe...
Quote:
Ok, please disregard my last posting. I talked before I thought. :)
>
I did what you said and now I am getting this error:
The expression BeforeInsert you entered as the event property setting
produced the following error: Ambiguous name detected: Form_BeforeInsert.
>
Phil Stanton wrote:
Quote:
>>On the main form have an unbound textbox called DateEnter
>>
>>On the Subform have the DateField called say DateEvent
>>
>>Then you need this bit of code on the BeforeInsert Event on the subform.
>>(You might consider setting the DefautValue of DateEvent = Date() to set
>>today's date)
>>
>>Option Compare Database
>>Option Explicit
>>
>>Private Sub Form_BeforeInsert(Cancel As Integer)
>>
> If IsNull(DateEvent) Then
> If Not IsDate(Me.Parent!DateEnter) Then
> MsgBox "There is no date on the top of the form",
>vbInformation
> Cancel = True
> Exit Sub
> Else
> DateEvent = Me.Parent!DateEnter
> End If
> End If
>>
>>End Sub
>>
>>HTH
>>
>>Phil
>>
Quote:
>>>I have a table that has three fields. First is date, Second is a text
>>>field,
>>[quoted text clipped - 10 lines]
Quote:
>>set to continuous. However, when I enter in the date and then enter the
>>other two fields when I hit tab it clears out the date.
>
--
Message posted via http://www.accessmonster.com
>

ladybug via AccessMonster.com
Guest
 
Posts: n/a
#7: Aug 23 '07

re: Control on Continuous Form


The only code I have in the subform is what you gave me:
Private Sub Form_BeforeInsert(Cancel As Integer)
Option Compare Database
Option Explicit

Private Sub Form_BeforeInsert(Cancel As Integer)

If IsNull(DateEvent) Then
If Not IsDate(Me.Parent!DateEnter) Then
MsgBox "There is no date on the top of the form", vbInformation
Cancel = True
Exit Sub
Else
DateEvent = Me.Parent!DateEnter
End If
End If

End Sub

Phil Stanton wrote:
Quote:
>Odd.
>
>The BeforInsert shoul only be on the subform. There should be no code on the
>main form
>
>Can you select ALL the code on the subform, copy it into your reply and post
>it to the NewsGroup I guess there may be a difference in the names of the
>controls
>
>Phil
>
Quote:
>Ok, please disregard my last posting. I talked before I thought. :)
>>
>[quoted text clipped - 37 lines]
Quote:
Quote:
>>>set to continuous. However, when I enter in the date and then enter the
>>>other two fields when I hit tab it clears out the date.
--
Message posted via http://www.accessmonster.com

Phil Stanton
Guest
 
Posts: n/a
#8: Aug 23 '07

re: Control on Continuous Form




OK The problem is the very first line. Delete it, it occurs twice and is in
the wrong place. The first line should be

Option Compare Database

In fact the first lines ov erery module should (always) be
Option Compare Database
Option Explicit

Phil

"ladybug via AccessMonster.com" <u21071@uwewrote in message
news:7722a31a30771@uwe...
Quote:
The only code I have in the subform is what you gave me:
Private Sub Form_BeforeInsert(Cancel As Integer)
Option Compare Database
Option Explicit
>
Private Sub Form_BeforeInsert(Cancel As Integer)
>
If IsNull(DateEvent) Then
If Not IsDate(Me.Parent!DateEnter) Then
MsgBox "There is no date on the top of the form", vbInformation
Cancel = True
Exit Sub
Else
DateEvent = Me.Parent!DateEnter
End If
End If
>
End Sub
>
Phil Stanton wrote:
Quote:
>>Odd.
>>
>>The BeforInsert shoul only be on the subform. There should be no code on
>>the
>>main form
>>
>>Can you select ALL the code on the subform, copy it into your reply and
>>post
>>it to the NewsGroup I guess there may be a difference in the names of the
>>controls
>>
>>Phil
>>
Quote:
>>Ok, please disregard my last posting. I talked before I thought. :)
>>>
>>[quoted text clipped - 37 lines]
Quote:
>>>>set to continuous. However, when I enter in the date and then enter
>>>>the
>>>>other two fields when I hit tab it clears out the date.
>
--
Message posted via http://www.accessmonster.com
>

ladybug via AccessMonster.com
Guest
 
Posts: n/a
#9: Aug 27 '07

re: Control on Continuous Form


THANK YOU!!!!!!!!!!!!!!!!!
Phil Stanton wrote:
Quote:
>OK The problem is the very first line. Delete it, it occurs twice and is in
>the wrong place. The first line should be
>
>Option Compare Database
>
>In fact the first lines ov erery module should (always) be
>Option Compare Database
Option Explicit
>
>Phil
>
Quote:
>The only code I have in the subform is what you gave me:
>Private Sub Form_BeforeInsert(Cancel As Integer)
>[quoted text clipped - 34 lines]
Quote:
Quote:
>>>>>the
>>>>>other two fields when I hit tab it clears out the date.
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200708/1

Closed Thread