Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / February 2008

Tip: Looking for answers? Try searching our database.

Sub Form specific values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan @BCBS - 04 Feb 2008 20:26 GMT
My Objective:
User enters data in a field on a form.
The form has a subform.

When data is entered, only 2 choices appear on the combo box, on the subform.
And the user cannot close the form unless one is picked.

Here is what I have so far, but I'm stick on the last line, etc.
If Me.TR_ACKNOWLTR <> " " Then
If MsgBox("You pick from combo box.  Continue? ", vbQuestion & vbYesNo,
"Question") = vbYes Then

Me!f_CaseLog!CA_NAME = "AG" or "AL"
(Need only AG or AL to appear in combo box)
(Need to not allow form to be closed until one is picked).

Help!
Jeanette Cunningham - 04 Feb 2008 21:15 GMT
Dan,
Set up the row source for the combo on the combo's property dialog.
On the Data tab, set the Row Source Type to Value List
In the Row Source type the following:
"AG";"AL"

If the Before update event for the subform put code like this:

If IsNull(Me.TheCombo) Then
   Msgbox "You must choose the group/type/category"
   Cancel = True
End If

Replace TheCombo with the name of your combo and group/type/category with
whatever fits..

Jeanette Cunningham

> My Objective:
> User enters data in a field on a form.
[quoted text clipped - 14 lines]
>
> Help!
Arlend Floyd - 05 Feb 2008 05:54 GMT
I have a simular problem but it is a list box in a sub form. When a user trys
to close the parent form I want to check if list box "Client" was answered
first. But the forms just close??

Private Sub Form_BeforeUpdate(Cancel As Integer)

If IsNull(Me.Client) Then
    MsgBox "Select Client before you can close"
    Cancel = True
   
End If
End Sub

> Dan,
> Set up the row source for the combo on the combo's property dialog.
[quoted text clipped - 32 lines]
> >
> > Help!
Jeanette Cunningham - 05 Feb 2008 06:04 GMT
Arlend,
the code below:

> Private Sub Form_BeforeUpdate(Cancel As Integer)
>
[quoted text clipped - 4 lines]
> End If
> End Sub

needs to go on the subform's before update event, not the parent form's
before update event.
I assume Client is the name of the Listbox control.
Make sure you select the subform, then the subform's before update event and
make sure the code is there.

The way access works - when you move your cursor out of the subform and onto
the parent form, it triggers an automatic save of the data on the subform.

Jeanette Cunningham

>I have a simular problem but it is a list box in a sub form. When a user
>trys
[quoted text clipped - 46 lines]
>> >
>> > Help!
Arlend Floyd - 05 Feb 2008 06:14 GMT
Yes this works. But here is my problem, the subform is not always clicked on.
Is there a way to do this check when the subform is never touched?

> Arlend,
> the code below:
[quoted text clipped - 69 lines]
> >> >
> >> > Help!
Jeanette Cunningham - 05 Feb 2008 06:25 GMT
It's a bit unusual - users can usually add a new parent record without
adding a child record. Users can usually add several child records to the
same parent record.
Tell us more about your parent form and subform. What data is being entered,
what is the linking field, why would you want the user to always fill in the
client on the subform?

Jeanette Cunningham

> Yes this works. But here is my problem, the subform is not always clicked
> on.
[quoted text clipped - 79 lines]
>> >> >
>> >> > Help!
Arlend Floyd - 05 Feb 2008 06:41 GMT
The parent form is the users main viewing place of lots of diff. data from
diff. tables the sub form im talking about has four questions that would be
updated if they did work on that customer. If no work was done then it would
be left blank. Im trying to create a msgbox as a reminder to update client if
work was done.

hope this makes sense.

> It's a bit unusual - users can usually add a new parent record without
> adding a child record. Users can usually add several child records to the
[quoted text clipped - 88 lines]
> >> >> >
> >> >> > Help!
Jeanette Cunningham - 05 Feb 2008 07:52 GMT
Yes, I think I understand what you want to do.
I assume there is no parent - child relationship between the data in the
main form and the subform.
Users need the option to update client or not.
I don't have any good solutions. - Don't know if this will work, I haven't
tried it. Suggestion is put an option group on the main form asking if work
was done for the client shown on the main form. Make it with 2 choices yes
or no. Make it compulsory to fill in. In the code for the close button on
the main form, have code that checks the client details table to see if
there is data for that particular client when work was done  - if not, pop
up a message and keep the form open. Users could change the option group to
no, to avoid filling in the client details. I don't really know of any
system to force users to keep a database up to date with all data.

Jeanette Cunningham

> The parent form is the users main viewing place of lots of diff. data from
> diff. tables the sub form im talking about has four questions that would
[quoted text clipped - 108 lines]
>> >> >> >
>> >> >> > Help!
Arlend Floyd - 05 Feb 2008 21:10 GMT
Thanks form all your help Jeanette'

Arlend

> Yes, I think I understand what you want to do.
> I assume there is no parent - child relationship between the data in the
[quoted text clipped - 124 lines]
> >> >> >> >
> >> >> >> > Help!
Dan @BCBS - 05 Feb 2008 14:50 GMT
Don't beleive I can do it that way:
1. The combo was created from ta table so the row source already has a value.
2. the combo box has other code associated with it in the "On Change"

That is why I have, vbQuestion if Yes then only AG or AL should appear in
the combo box.  This is were I'm stuck!!

Me!f_CaseLog!CA_NAME = "AG" or "AL"

> Dan,
> Set up the row source for the combo on the combo's property dialog.
[quoted text clipped - 32 lines]
> >
> > Help!
Dan @BCBS - 05 Feb 2008 16:00 GMT
I am reposting this question with Subj: Subform combo box

> Don't beleive I can do it that way:
> 1. The combo was created from ta table so the row source already has a value.
[quoted text clipped - 41 lines]
> > >
> > > Help!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.