PC Review


Reply
Thread Tools Rate Thread

Add record subform problem

 
 
=?Utf-8?B?QWNjZXNzTm92aWNl?=
Guest
Posts: n/a
 
      11th Oct 2006
When I click the 'add record' button on the navigation toolbar, a blank
record appears in the fields of my main form, but the text boxes to enter
data into my subforms disappear making impossible to enter data into the
subforms. What is causing this?

 
Reply With Quote
 
 
 
 
Vinayak N
Guest
Posts: n/a
 
      11th Oct 2006
Hi,

Try entering some data into the main form fields and then see if you
get the text boxes available in the sub-form for entering data.

I know the step that I have told is very elementary but still let me
know if you have already tried it and also then explain your problem a
bit more in detail later.

Regards,
Vinayak

AccessNovice wrote:

> When I click the 'add record' button on the navigation toolbar, a blank
> record appears in the fields of my main form, but the text boxes to enter
> data into my subforms disappear making impossible to enter data into the
> subforms. What is causing this?


 
Reply With Quote
 
=?Utf-8?B?QWNjZXNzTm92aWNl?=
Guest
Posts: n/a
 
      12th Oct 2006
No that didn't work. I think I found where the problem is, but still do not
know how to fix it. I wanted users to decide whether they wanted to add a
new record or edit an existing record. Instead of the navigation toolbar, I
inserted a "Add Record" command button. In the main form properties, I set
the AllowAddition Property to 'No' and in the 'On Click' code for the command
button, I inserted the following code:
Me.AllowAdditions = True

This works great with the main form, but does not allow new records to be
added to the subforms. When I removed the command button and put the
navigation toolbar back in and set the main form 'AllowAddition' Property
back to Yes, the subform still would not allow new entries.

I guess my question is now. Is it possible to use a not allow additions
unless an add record is clicked and still be able to add data to the
subforms? If so, what code am I leaving out? Also, will I have the same
problem when I create an edit button and change allowedit property to false?

Thank you for your help.



"Vinayak N" wrote:

> Hi,
>
> Try entering some data into the main form fields and then see if you
> get the text boxes available in the sub-form for entering data.
>
> I know the step that I have told is very elementary but still let me
> know if you have already tried it and also then explain your problem a
> bit more in detail later.
>
> Regards,
> Vinayak
>
> AccessNovice wrote:
>
> > When I click the 'add record' button on the navigation toolbar, a blank
> > record appears in the fields of my main form, but the text boxes to enter
> > data into my subforms disappear making impossible to enter data into the
> > subforms. What is causing this?

>
>

 
Reply With Quote
 
JK
Guest
Posts: n/a
 
      12th Oct 2006
If your subForm is linked to the main form on a key other than the form key,
that filed is Null, until you put a value in it.
Thus the subForm has nothing to link to.


Is that the case?

Regards/JK


"AccessNovice" <(E-Mail Removed)> wrote in message
news:3F403528-3364-4CFB-BD26-(E-Mail Removed)...
> No that didn't work. I think I found where the problem is, but still do
> not
> know how to fix it. I wanted users to decide whether they wanted to add a
> new record or edit an existing record. Instead of the navigation toolbar,
> I
> inserted a "Add Record" command button. In the main form properties, I
> set
> the AllowAddition Property to 'No' and in the 'On Click' code for the
> command
> button, I inserted the following code:
> Me.AllowAdditions = True
>
> This works great with the main form, but does not allow new records to be
> added to the subforms. When I removed the command button and put the
> navigation toolbar back in and set the main form 'AllowAddition' Property
> back to Yes, the subform still would not allow new entries.
>
> I guess my question is now. Is it possible to use a not allow additions
> unless an add record is clicked and still be able to add data to the
> subforms? If so, what code am I leaving out? Also, will I have the same
> problem when I create an edit button and change allowedit property to
> false?
>
> Thank you for your help.
>
>
>
> "Vinayak N" wrote:
>
>> Hi,
>>
>> Try entering some data into the main form fields and then see if you
>> get the text boxes available in the sub-form for entering data.
>>
>> I know the step that I have told is very elementary but still let me
>> know if you have already tried it and also then explain your problem a
>> bit more in detail later.
>>
>> Regards,
>> Vinayak
>>
>> AccessNovice wrote:
>>
>> > When I click the 'add record' button on the navigation toolbar, a blank
>> > record appears in the fields of my main form, but the text boxes to
>> > enter
>> > data into my subforms disappear making impossible to enter data into
>> > the
>> > subforms. What is causing this?

>>
>>



 
Reply With Quote
 
=?Utf-8?B?QWNjZXNzTm92aWNl?=
Guest
Posts: n/a
 
      12th Oct 2006
I'm not sure I know what you mean. Could you explain further? Thanks.

"JK" wrote:

> If your subForm is linked to the main form on a key other than the form key,
> that filed is Null, until you put a value in it.
> Thus the subForm has nothing to link to.
>
>
> Is that the case?
>
> Regards/JK
>
>
> "AccessNovice" <(E-Mail Removed)> wrote in message
> news:3F403528-3364-4CFB-BD26-(E-Mail Removed)...
> > No that didn't work. I think I found where the problem is, but still do
> > not
> > know how to fix it. I wanted users to decide whether they wanted to add a
> > new record or edit an existing record. Instead of the navigation toolbar,
> > I
> > inserted a "Add Record" command button. In the main form properties, I
> > set
> > the AllowAddition Property to 'No' and in the 'On Click' code for the
> > command
> > button, I inserted the following code:
> > Me.AllowAdditions = True
> >
> > This works great with the main form, but does not allow new records to be
> > added to the subforms. When I removed the command button and put the
> > navigation toolbar back in and set the main form 'AllowAddition' Property
> > back to Yes, the subform still would not allow new entries.
> >
> > I guess my question is now. Is it possible to use a not allow additions
> > unless an add record is clicked and still be able to add data to the
> > subforms? If so, what code am I leaving out? Also, will I have the same
> > problem when I create an edit button and change allowedit property to
> > false?
> >
> > Thank you for your help.
> >
> >
> >
> > "Vinayak N" wrote:
> >
> >> Hi,
> >>
> >> Try entering some data into the main form fields and then see if you
> >> get the text boxes available in the sub-form for entering data.
> >>
> >> I know the step that I have told is very elementary but still let me
> >> know if you have already tried it and also then explain your problem a
> >> bit more in detail later.
> >>
> >> Regards,
> >> Vinayak
> >>
> >> AccessNovice wrote:
> >>
> >> > When I click the 'add record' button on the navigation toolbar, a blank
> >> > record appears in the fields of my main form, but the text boxes to
> >> > enter
> >> > data into my subforms disappear making impossible to enter data into
> >> > the
> >> > subforms. What is causing this?
> >>
> >>

>
>
>

 
Reply With Quote
 
JK
Guest
Posts: n/a
 
      13th Oct 2006
Normally and the best way to do it, though not mandatory, is like this:

tbl (FrmMain Souce)
------

fldMain_ID (key)
Field
Field
Filed
etc.

tblDetail (SubForm Source)
-----
fldDetails_ID (key)
FldMain_ID (long, Foreign Key)
Field
Field
Field
Field
etc.

Link tblMain with tblDetail on the Main_ID as one-to-many relationship

In your *SubForm* properties you set *both*" Link Child Field" and "Link
Master Field" to "fldMain_ID" (no quotations marks)

if you still have problems, it will be easier to help you if you post here
your actual tables structures (just the relevant fields), realtinship, if
any and what you have now as Master and Child links.

Regards/JK




"AccessNovice" <(E-Mail Removed)> wrote in message
news:6BE052D0-1415-4F28-9325-(E-Mail Removed)...
> I'm not sure I know what you mean. Could you explain further? Thanks.
>
> "JK" wrote:
>
>> If your subForm is linked to the main form on a key other than the form
>> key,
>> that filed is Null, until you put a value in it.
>> Thus the subForm has nothing to link to.
>>
>>
>> Is that the case?
>>
>> Regards/JK
>>
>>
>> "AccessNovice" <(E-Mail Removed)> wrote in message
>> news:3F403528-3364-4CFB-BD26-(E-Mail Removed)...
>> > No that didn't work. I think I found where the problem is, but still
>> > do
>> > not
>> > know how to fix it. I wanted users to decide whether they wanted to
>> > add a
>> > new record or edit an existing record. Instead of the navigation
>> > toolbar,
>> > I
>> > inserted a "Add Record" command button. In the main form properties, I
>> > set
>> > the AllowAddition Property to 'No' and in the 'On Click' code for the
>> > command
>> > button, I inserted the following code:
>> > Me.AllowAdditions = True
>> >
>> > This works great with the main form, but does not allow new records to
>> > be
>> > added to the subforms. When I removed the command button and put the
>> > navigation toolbar back in and set the main form 'AllowAddition'
>> > Property
>> > back to Yes, the subform still would not allow new entries.
>> >
>> > I guess my question is now. Is it possible to use a not allow
>> > additions
>> > unless an add record is clicked and still be able to add data to the
>> > subforms? If so, what code am I leaving out? Also, will I have the
>> > same
>> > problem when I create an edit button and change allowedit property to
>> > false?
>> >
>> > Thank you for your help.
>> >
>> >
>> >
>> > "Vinayak N" wrote:
>> >
>> >> Hi,
>> >>
>> >> Try entering some data into the main form fields and then see if you
>> >> get the text boxes available in the sub-form for entering data.
>> >>
>> >> I know the step that I have told is very elementary but still let me
>> >> know if you have already tried it and also then explain your problem a
>> >> bit more in detail later.
>> >>
>> >> Regards,
>> >> Vinayak
>> >>
>> >> AccessNovice wrote:
>> >>
>> >> > When I click the 'add record' button on the navigation toolbar, a
>> >> > blank
>> >> > record appears in the fields of my main form, but the text boxes to
>> >> > enter
>> >> > data into my subforms disappear making impossible to enter data into
>> >> > the
>> >> > subforms. What is causing this?
>> >>
>> >>

>>
>>
>>




 
Reply With Quote
 
=?Utf-8?B?QWNjZXNzTm92aWNl?=
Guest
Posts: n/a
 
      13th Oct 2006
Ok. Now I understand. The phrase form key through me off. Here is my table
structure:

tblBulletin (frmBulletin main source)
---------------------------------------
BulletinID (Autonumber, Primary Key)
State
Bulletin Number
Date Issued
Date Effective
Title
Summary
Analyst

tblBill (main source for subfrmBill)
--------------------------------------
BulletinID (Long, Foreign Key, Combined with BillNumber - Primary Key)
BillNumber (Text, Combined with BulletID - Primary Key)

tblBulletinLOB (main source for subfrmLOB)
-------------------------------------------------
BulletinID (Long, Foreign Key, Combined with BulletinLOB - Primary Key)
BulletinLOB (Text, Combined with BulletinID - Primary Key)

tblCategory
---------------
BulletinID (Long, Foreign Key, Combined with BulletinCategory - Primary Key)
BulletinCategory (Text, Combined with BulletinID - Primary Key)

Tables tblCategory, tblBulletinLOB, and tblBill all have one-to-many
relationships with tblBulletin. In each subform, the Link Master Field
Property is set to BulletinID (tblBulletin) and the Link Child Property is
set to BulletinID.

I think that is about all the relevant information pertaining the problem.
Let me know if you have any suggestions.

Thank you.


"JK" wrote:

> Normally and the best way to do it, though not mandatory, is like this:
>
> tbl (FrmMain Souce)
> ------
>
> fldMain_ID (key)
> Field
> Field
> Filed
> etc.
>
> tblDetail (SubForm Source)
> -----
> fldDetails_ID (key)
> FldMain_ID (long, Foreign Key)
> Field
> Field
> Field
> Field
> etc.
>
> Link tblMain with tblDetail on the Main_ID as one-to-many relationship
>
> In your *SubForm* properties you set *both*" Link Child Field" and "Link
> Master Field" to "fldMain_ID" (no quotations marks)
>
> if you still have problems, it will be easier to help you if you post here
> your actual tables structures (just the relevant fields), realtinship, if
> any and what you have now as Master and Child links.
>
> Regards/JK
>
>
>
>
> "AccessNovice" <(E-Mail Removed)> wrote in message
> news:6BE052D0-1415-4F28-9325-(E-Mail Removed)...
> > I'm not sure I know what you mean. Could you explain further? Thanks.
> >
> > "JK" wrote:
> >
> >> If your subForm is linked to the main form on a key other than the form
> >> key,
> >> that filed is Null, until you put a value in it.
> >> Thus the subForm has nothing to link to.
> >>
> >>
> >> Is that the case?
> >>
> >> Regards/JK
> >>
> >>
> >> "AccessNovice" <(E-Mail Removed)> wrote in message
> >> news:3F403528-3364-4CFB-BD26-(E-Mail Removed)...
> >> > No that didn't work. I think I found where the problem is, but still
> >> > do
> >> > not
> >> > know how to fix it. I wanted users to decide whether they wanted to
> >> > add a
> >> > new record or edit an existing record. Instead of the navigation
> >> > toolbar,
> >> > I
> >> > inserted a "Add Record" command button. In the main form properties, I
> >> > set
> >> > the AllowAddition Property to 'No' and in the 'On Click' code for the
> >> > command
> >> > button, I inserted the following code:
> >> > Me.AllowAdditions = True
> >> >
> >> > This works great with the main form, but does not allow new records to
> >> > be
> >> > added to the subforms. When I removed the command button and put the
> >> > navigation toolbar back in and set the main form 'AllowAddition'
> >> > Property
> >> > back to Yes, the subform still would not allow new entries.
> >> >
> >> > I guess my question is now. Is it possible to use a not allow
> >> > additions
> >> > unless an add record is clicked and still be able to add data to the
> >> > subforms? If so, what code am I leaving out? Also, will I have the
> >> > same
> >> > problem when I create an edit button and change allowedit property to
> >> > false?
> >> >
> >> > Thank you for your help.
> >> >
> >> >
> >> >
> >> > "Vinayak N" wrote:
> >> >
> >> >> Hi,
> >> >>
> >> >> Try entering some data into the main form fields and then see if you
> >> >> get the text boxes available in the sub-form for entering data.
> >> >>
> >> >> I know the step that I have told is very elementary but still let me
> >> >> know if you have already tried it and also then explain your problem a
> >> >> bit more in detail later.
> >> >>
> >> >> Regards,
> >> >> Vinayak
> >> >>
> >> >> AccessNovice wrote:
> >> >>
> >> >> > When I click the 'add record' button on the navigation toolbar, a
> >> >> > blank
> >> >> > record appears in the fields of my main form, but the text boxes to
> >> >> > enter
> >> >> > data into my subforms disappear making impossible to enter data into
> >> >> > the
> >> >> > subforms. What is causing this?
> >> >>
> >> >>
> >>
> >>
> >>

>
>
>
>

 
Reply With Quote
 
JK
Guest
Posts: n/a
 
      14th Oct 2006
Hmmm, Your structure is ok - I must be some thing else

In order to look for the problem, go to your property sheets of *both* forms
and change or ensure that *both* Allow Edits and Allow Additions are turned
on

Lets start from the obvious

A trap I occasionally fall into is to forget to make the subform a
continuous form. if you fell into the same trap in your sub form you will
see only one record, if there are any, or if there are no records you will
see only the new record. IIf you fell into the same trap, correct it.

Now, create a command button that do nothing (if your wizard is turned on
press cancel, in the wizard after you have drawn the button.

1. Open the property sheet for the button name and name it, Lets call it
"AddButton" (No quotations marks). Put in the caption or image, as you wish

2. Now, there are two possibilities:

a) Once the user click on "AddButton", he can add records regardless of
which record he/she will be in subsequently

Private Sub AddButton_Click()

Dim strSubForm As String

strSubForm = "YourSubForm"

Me.Form.AllowAdditions = True
Form(strSubForm).Form.AllowAdditions = True
'Note: both "Form" in singular

DoCmd>GoToControl "Your first field on the main form"


End Sub


b) The user has to click the "AddButton" every time he/she wants to add a
record.

Still use the Click event as above but add to the On Current Event Sub
( or Create one)

Dim strSubForm As String

strSubForm = "YourSubForm"

If Me.Form.NewRecord Then
Form(strSubForm).Form.AllowAdditions = True
Else
Me.Form.AllowAdditions = False
Form(strSubForm).Form.AllowAdditions = False
End If

+++++++
Advise: Always keep the AllowEdits turned on, if it is turned off you cannot
click buttons or use the scroll bars. you can disable (or lock) the fields
you want protected, if need be. If you disable a field *and* lock it you
will maintain the colour (i.e. it will not grey out).

My apology if I taught grandma how to sack eggs, Let me know how you go.

Regards/JK


"AccessNovice" <(E-Mail Removed)> wrote in message
news:52A202AA-F925-4F59-94F1-(E-Mail Removed)...
> Ok. Now I understand. The phrase form key through me off. Here is my
> table
> structure:
>
> tblBulletin (frmBulletin main source)
> ---------------------------------------
> BulletinID (Autonumber, Primary Key)
> State
> Bulletin Number
> Date Issued
> Date Effective
> Title
> Summary
> Analyst
>
> tblBill (main source for subfrmBill)
> --------------------------------------
> BulletinID (Long, Foreign Key, Combined with BillNumber - Primary Key)
> BillNumber (Text, Combined with BulletID - Primary Key)
>
> tblBulletinLOB (main source for subfrmLOB)
> -------------------------------------------------
> BulletinID (Long, Foreign Key, Combined with BulletinLOB - Primary Key)
> BulletinLOB (Text, Combined with BulletinID - Primary Key)
>
> tblCategory
> ---------------
> BulletinID (Long, Foreign Key, Combined with BulletinCategory - Primary
> Key)
> BulletinCategory (Text, Combined with BulletinID - Primary Key)
>
> Tables tblCategory, tblBulletinLOB, and tblBill all have one-to-many
> relationships with tblBulletin. In each subform, the Link Master Field
> Property is set to BulletinID (tblBulletin) and the Link Child Property is
> set to BulletinID.
>
> I think that is about all the relevant information pertaining the problem.
> Let me know if you have any suggestions.
>
> Thank you.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Problem with subform to last record DocBrown Microsoft Access Form Coding 1 5th Sep 2008 02:21 AM
Double click record in subform to go to new record in Main (and subform) Jpipher@gmail.com Microsoft Access 14 3rd Feb 2007 07:06 AM
code to delete a record in one subform when a record in a related subform is deleted Helen Microsoft Access Form Coding 3 3rd Apr 2005 10:01 PM
Urgent !!! - Values from Subform - #Error if no records in Subform and Only grabs first subform record Greg Microsoft Access Forms 0 17th Feb 2005 01:12 PM
form / subform - problem adding new record! - can't save main record Bob Microsoft Access Forms 2 7th Oct 2003 06:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:20 PM.