Multiple SubForms - SQL Statement

Oct 5, 2005

I'm new to programing so if this is not possible please tell me! Because this is going to be hard to explain I attached an example.

I have a Main form that a user will open, this is the only window that will ever pop up in front of them so it has a subform that will open differnt froms by picking buttons on the left.

One of the sub forms is the Member Information form, this form will show member information than at the bottom has another subform that will allow a user to pick a button above it to open another subform (this is so member info is always show and a member can be registered, pay...all different subforms)

on the Event Register subform the "Class" pulldown is based on the event that was pick just above it.

Issue:
when I am in the main form, I can not get the class pulldown to work it always prompts me for "enter Parameter Value". I have tried the following SQL statements in the row source and noting work.. what am I missing???


SELECT SubCatList.SubCatName, SubCatList.EventName
FROM SubCatList
WHERE (((SubCatList.EventName)=[Forms].[MainFRM]![MemberInfoFRM].Form]![EventRegFRM].[Form]![EventName]));

and

SELECT SubCatList.SubCatName, SubCatList.EventName
FROM SubCatList
WHERE (((SubCatList.EventName)=[Forms]![MainFRM]![MainSubFRM]![Form]![memberinfoFRM]![MemberSubFRM].[Form].[EventName]));

View Replies


ADVERTISEMENT

Multiple Subforms

Jul 13, 2005

I have three subforms that i want to open optionally by using one open button after selecting the form that i want to open from a combo box.


or open the subform when the value in the combo box changes.

Please help

View 1 Replies View Related

Creating Multiple Subforms

Nov 13, 2005

I am trying to add multiple subforms (or subtables?) on an existing form. The underlying table is a very detailed descriptive table for art in a collection, I am already using one subtable to manage the movement in and out of inventory. When I look at the table in the datasheet view, I see the "+" sign next to each record, and when I click on that, I see the subtable I already have setup - looking at that, it seems impossible to have more than one subtable... is this true? This does not seem right.

My question is this:
Can I have more than one subform in a given form? What I would like to have is a subform to keep track of provenance for any given piece (history of ownership), and another to track appraisals (values, dates, appraiser, etc) of any given piece in the collection.

Are there any samples of what I am trying to do?

View 1 Replies View Related

How To Add Values From Multiple Subforms

Jun 20, 2012

how to add times together from multiple subforms and display the data on the main form. Just for backround, I am creating a timesheet to be used by our workshop employees. The form is set up in such a way that there is a combo box where they can select their name which rotates the record so all the data is specific to their id, and then there is a tab box with a tab for each day of the week each containing its own subform with combo boxes to select the project they worked on, text boxes to enter the start time and stop time for that project, and then 2 other text boxes: one that calculates time worked on that particular project and then one that calculates the total time worked for the day since they typically work on more than one project in a day. So what I need to do is to take the values from the total daily hours boxes and add them all together and show the sum in a box showing the total hours worked for the week.

My most recent attempt was to simply make an expression in the control source as follows:

=[Sunday subform].[Form]![Daily Hours]+[Monday subform].[Form]![Daily Hours]+[Tuesday subform].[Form]![Daily Hours]+[Wednesday subform].[Form]![Daily Hours]+[Thursday subform].[Form]![Daily Hours]+[Friday subform].[Form]![Daily Hours]+[Saturday subform].[Form]![Daily Hours]

View 2 Replies View Related

Combo Box Controlling Multiple Subforms

Apr 21, 2005

Hi,

I'm v.new to Access so do excuse my ignorance.
I have a form with a combo-box with the following values:
Trust, Course, Overseas, GP
When Trusts is selected I'ld like frmtrust_sub to appear.
When anything else is selected I'ld like frmnontrust_sub to appear
Once the data has been entered in the subform the user would continue back to the main form.
I'ld like the subforms to remain hidden until needed, if possible so as not to confuse users.

I’ve copied this piece of code and have tried pasting it into the “after update” event procedure but I get this error message

“the link masterfields property section has produced this error “Ambiguous name detected: Type_afterupdate”


Private Sub Type_AfterUpdate()

Option Compare Database

Sub ShowSubform()

'Save unsaved changes to currently open subform
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

'Display appropriate subform based on Type chosen
If Type = "Trust" Then
frmtrust_sub.Visible = True
frmnontrust_sub.Visible = False

ElseIf Type = "GP" Then
frmnontrust_sub.Visible = True
frmtrust_sub.Visible = False

ElseIf Type = "Course" Then
frmnontrust_sub.Visible = True
frmtrust_sub.Visible = False

ElseIf Type = "Overseas" Then
frmnontrust_sub.Visible = True
frmtrust_sub.Visible = False

ElseIf Type = "Other" Then
frmnontrust_sub.Visible = True
frmtrust_sub.Visible = False


End If

End Sub

Private Sub cmdClose_Click()

'Close form
DoCmd.Close

End Sub

Private Sub Form_Current()

'Call subroutine to display appropriate subform based on template type
ShowSubform

End Sub

Private Sub Type_AfterUpdate()

'Call subroutine to display appropriate subform based on template type
ShowSubform

End Sub


Any help would be greatly appreciated

thanks

Barry

View 1 Replies View Related

Display And Empower Multiple Subforms

Mar 27, 2006

Combo boxes cboTN and cboSB are on my main form. cboTN is a search combo box that updates combo box cboSB with one of 3 values (ID, IDC, or MC).

I would like to do the following:

1:
If the after-update value of cboSB is ID, subform sf1 will be visible.
If the after-update value of cboSB is IDC, subform sf2 will be visible.
If the after-update value of cboSB is MC, subform sf3 will be visible.
(only one subform visible at a time since they are stacked in one place on my main form)

2:
Once the appropriate subform is displayed, is it possible to use option buttons to set the property of the subform to either Add-only mode or Edit-only mode? If so, how? (perhaps some sort of Case A, Case B scenario with the option buttons?)

If you can help with either of the above; example codes would help my novice skills greatly!

View 10 Replies View Related

Multiple Tables, One Form With 3 Subforms Problems

Dec 16, 2007

Hi Guys & Gals, I have an Access 2007 database that I am fighting with. I have a friend who needs a data entry database. So far I have created 4 tables: Cases, Customers, Data1, Data2.
Cases_tbl has following fields:ID(autonumber), Customers_ID(number), Data1_ID(number), Data2_ID(number).

The Customers, Data1 and Data2 Tables are all similiar, they all have the ID(autonumber) Field followed be fields that need data inputed.

I would like to have the Cases table as the master table that is linked to the other 3 tables, so when I delete a customer, there case, and all of there data is deleted with it.

I have one form with 3 subforms. Each subform is used for inputing data into the customer, data1, and data2 tables. However, I cannot for the life of me link all these tables together. I have tried all different relationships and have search the web high and low and I cannot find an answer anywhere. So if somebody could help I would be much appreciative.

View 11 Replies View Related

Forms :: Timesheet - Filtering Multiple Subforms

Sep 22, 2014

I have a form for timesheet entry that has 2 subforms.

The main form has a combo box for selecting staff name and another for WkEnding date. The form is based on table "SELECT StaffRef, WkEnding, Status FROM tTimesheets".

SubForm sfTimesheets is based on table tTimesheets. The subform is linked by StaffRef and WkEnding. (This has been working for ages.)

Recently added second subform sfOnCall based on table tOnCall. The subform is also linked by StaffRef and WkEnding.

If the user has a timesheet entry for the date, then sfOnCall displays and operates ok. But if there is no entry in the timesheet table, the sfOnCall form doesn't show the appropriate entry from the OnCall table.
-
I did try basing the main form on a UNION of the 2 tables, but whilst the query showed the correct data when I ran it - all the controls on the form disappeared!

View 3 Replies View Related

Modules & VBA :: Exporting Multiple Subforms Into One Subform

Aug 4, 2014

I've got a Main Form with :combobox "Name" that changes subform results

: Subform w/ container name "subform34"
: Subform w/ container name "subform35"
............................. "subform36"

I want to be able to do the following for each subform:

Me.subform34.SetFocus
DoCmd.GoToControl "Field1"
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand (acCmdCopy) ***

Except for starred line, I'm thinking I could save the records as Long, I don't really know.

Someone brought up the possibility of writing SQL to generate a query then export the query.. but don't know...

View 1 Replies View Related

Adding Data To Multiple Tables With Subforms

Mar 2, 2015

I am new to access but I am familiar with SQL databases. I have two tables: one for project data and another for project leader data. These tables are linked by a third table that relates projectIDs to leaderIDs. I am currently working on making a form that will go through each project and display the people involved in each project in a subform. I pulling the data from the the leader table that matches the the projectID with a query.

I would like to be able to update the information in this subform directly (which I can currently do) and be able to add new project leaders to a project. What is the best way to add the new leader to this? If a person is already in the database how do I add them with the form without re-adding new information to the table?

View 3 Replies View Related

Forms :: Setting Sort Order On A Form With Multiple Subforms

Mar 4, 2014

I have a tabbed form. The main form is titles ContractDtlsFRM. There are 3 other subforms in separate tabs. The first field in the ContractDtlsFRM is Contract No. I would like the form to sort in ascending order by this number.

I tried entering the following code in the Forms Order By event but it didn't work

Private Sub Form_Open(Cancel As Integer)
Me.OrderByOn = True
Me.OrderBy = [Contract No]
End Sub

View 2 Replies View Related

Forms :: Main Form With Multiple Tabs - Sync Two Related Subforms

Jul 28, 2014

I have a main form with multpile tabs - each tab containing a different subform.

Link Master Field: ClientID (field in Master Form)
Link Child Field: Client ID (field in all subforms)

There is another field that all the subforms (continuous type) have: ObligorName. All the subforms are based off of a huge table (subtable) with fields: Obligor Name, Address, Zipcode, City, DOcuments Required, Bank Account Number, etc......

Essentially, the user will fill in the 10 obligor names associated to ONE client on the first subform on the first tab + address + zip code + city.

When the user clicks on the second tab to fill out the next subform, I want all 10 obligor names to be there already, so then they can fill out Documents Required + BAnk Account Number.

If I fill out the first subform and then exit out of the form and then reopen it, the other subforms autofill.

HOWEVER, I dont want to have the user have to do this. It wastes a lot of time. What can I do about this so that the table is automatically updated right away. They are all based on the same table so I do not see why there is so many issues.

View 14 Replies View Related

Multiple IF Statement

Jun 6, 2007

I have a field which shows numbers 1-8 or is null.
I want to group this to show if its 1,3,5,7 then it shows as "BOOK" else if its 2,4,6,8 then its "CHAIR" and if its null then show it as null
Can anyone help - I am using Access 2003

View 2 Replies View Related

Multiple Queries, One Statement?

Aug 15, 2005

Hi all,

I thought the whole point of the ; sign at the end of a sql statement in access was so that you can
run more than one query at a time?
if this is the case, could you tell me why this doesn't work?
Code: sqlStr = "UPDATE tabControlFeeType SET FeeAmount = " & txtFirst.Text & " WHERE KeyFeeType = 1;" & _ "UPDATE tabControlFeeType SET FeeAmount = " & txtSecond.Text & " WHERE KeyFeeType = 2;" & _ "UPDATE tabControlFeeType SET FeeAmount = " & txtThird.Text & " WHERE KeyFeeType = 3;" Dim comm As New OleDbCommand(sqlStr, conn) comm.ExecuteNonQuery()
the query doesn't work if I put it straight into access either?

do I just have this wrong?

Thanx

View 2 Replies View Related

If Statement With Multiple Controls

Jul 14, 2006

Hello,

I have a form with multiple controls (textboxes) named:
Father
Mother
Child1
Child2

On the form there are also two checkboxes (check1 and check2).

I am using the following statement for each control and placed in in the OnCurrent event of my form:
If Not IsNull (Me.Fater) Then
Me.Check1 = "YES" (or -1)
Me.Check2.Value = False
End IF

Is there a way I can write one If statement saying:
If all controls Father, Mather, Child1 and Child2 or at least one of them has data, then Check1 should be selected and check2 emply. If all controls do not have data then ckeck1 should be empty and check2 selected.

Thank you.

View 2 Replies View Related

Modules & VBA :: Multiple And In If Then Statement

Oct 1, 2013

I have the following code on an After Update event:

If Me.Program_Type.Value = "(1) 45 Minute Formal" And Me.Cost_Category = "Full Price" Then
Me.ProgPriceTxt.Value = "85"
End If

This works fine. When I add another "And" to the statement, however, it no longer functions:If

Me.Program_Type.Value = "(1) 45 Minute Formal" And Me.Cost_Category = "Full Price" And Me.PavRentCheck = False Then
Me.ProgPriceTxt.Value = "85"
End If

Is it possible to put three conditions into an And statement? This thread seems to imply so (it's a different situation, but it seems close enough).

I believe it doesn't have anything to do with my text boxes or fields because this same issue has occurred in other places when I tried to have three conditions in an And statement.

View 11 Replies View Related

Interpreting Multiple IIF Statement

May 20, 2015

I've "inherited" someone else access DB and I need to interpret this selection logic:

IIf(IsNull(a.[Lifecycle Stage 4 Sub-Stage]),IIf(IsNull(a.[Lifecycle Sub Stage 2]), a.[Lifecycle Stage], a.[Lifecycle Sub Stage 2]), a.[Lifecycle Stage 4 Sub-Stage]) AS [Sanitized Phase],

What I think it's saying:

If [Lifecycle Sub Stage 2] is null, use [Lifecycle stage], if [Lifecycle Sub Stage 2] is not null use [Lifecycle Sub Stage 2].
If [Lifecycle Stage 4 Sub-Stage] is not null, use [Lifecycle Stage 4 Sub-Stage].

I am not 100% sure if this is the correct interpretation as I have not had much previous experience interpreting multiple IIF statements in access. My aim is to migrate this process to Oracle, so I am just trying to get a handle around all the Access logic so that I can replicate the same behavior in another environment.

View 1 Replies View Related

Select Statement For Multiple States

Mar 14, 2006

Hello,

First off thanks for this forum it has gotten me this far. 2nd I have a question on how the best way to accomplish this. So I have a table that has customer info in it, Account #, Name, city, state, Zip. I have a form that allows users to type in fields to query for particular info. My select statement is below.

Private Sub cmdSearch_Click()
Dim strSQL As String, strOrder As String, strWhere As String
Dim dbNm As Database
Dim qryDef As QueryDef
Set dbNm = CurrentDb()

strSQL = "SELECT tblCONSOLIDATED.ACCOUNT1, tblCONSOLIDATED.COMPANY_NAME, tblCONSOLIDATED.CUSTOMER_TYPE, tblCONSOLIDATED.ADDRESS1, tblCONSOLIDATED.ADDRESS2, tblCONSOLIDATED.CITY, tblCONSOLIDATED.STATE, tblCONSOLIDATED.ZIP, tblCONSOLIDATED.CONTACT_NAME, tblCONSOLIDATED.E_MAIL, tblCONSOLIDATED.TELEPHONE, tblCONSOLIDATED.FAX, tblCONSOLIDATED.REP_NUMBER, tblCONSOLIDATED.PROMOCODE, tblCONSOLIDATED.SALESCODE, tblCONSOLIDATED.CURRENT_YTD, tblCONSOLIDATED.PRIOR_YTD, tblCONSOLIDATED.PRIOR_TOTAL, tblCONSOLIDATED.YEAR2_TOTAL, tblCONSOLIDATED.YEAR3_TOTAL, tblCONSOLIDATED.YEAR4_TOTAL " & _
"FROM tblCONSOLIDATED"

If Not IsNull(Me.txtCSONME) Then
strWhere = strWhere & " (tblCONSOLIDATED.COMPANY_NAME) Like '*" & Me.txtCSONME & "*' AND"
End If

If Not IsNull(Me.txtCSOSLD) Then
strWhere = strWhere & " (tblCONSOLIDATED.ACCOUNT1) Like '*" & Me.txtCSOSLD & "*' AND"
End If

If Not IsNull(Me.txtCSOSSM) Then
strWhere = strWhere & " (tblCONSOLIDATED.REP_NUMBER) Like '*" & Me.txtCSOSSM & "*' AND"
End If

If Not IsNull(Me.txtCSOARN) Then
strWhere = strWhere & " (tblCONSOLIDATED.CONTACT_NAME) Like '*" & Me.txtCSOARN & "*' AND"
End If

If Not IsNull(Me.txtCSOCTY) Then
strWhere = strWhere & " (tblCONSOLIDATED.CITY) Like '*" & Me.txtCSOCTY & "*' AND"
End If

If Not IsNull(Me.txtCSOST) Then
strWhere = strWhere & " (tblCONSOLIDATED.STATE) Like '*" & Me.txtCSOST & "*' And"
End If


Everything works but I can only search for one state. So now I want to search for two or more states. I've added multiple text fields on my form and have tried approaching it that way. Unfortunily if I add txtCSOST2 for example then add

If Not IsNull(Me.txtCSOST2) Then
strWhere = strWhere & " (tblCONSOLIDATED.STATE) Like '*" & Me.txtCSOST2 & "*' And"
End If

tblCONSOLIDATED.STATE has to contain both state codes. If I put an Or instead of And I get both states and all other search critera is ignored. Basically I need to be able to query by two or more states and it still be an and I guess. For example we may have a Rep A (Me.txtCSOSSM) that goes into TX & OK but Rep B also has a peice of TX. If I'm looking all the accounts that are in TX & OK and are Rep A and I use the below code I get all of the TX & OK accounts as well as Rep A accounts.

If Not IsNull(Me.txtCSOST) Then
strWhere = strWhere & " (tblCONSOLIDATED.STATE) Like '*" & Me.txtCSOST & "*' Or"
End If

If Not IsNull(Me.txtCSOST2) Then
strWhere = strWhere & " (tblCONSOLIDATED.STATE) Like '*" & Me.txtCSOST2 & "*' Or"
End If

I know that has to be simple I just wrap my brain around it. Let me know if this needs further explaination.

Thanks in advance.

Bryan

View 3 Replies View Related

Multiple If Numberic Statement From A Table

Jul 20, 2006

I have tried searching and haven't found an answer to this question.

I have a calculated field in a query that returns a aging date to an invoice. I want to take that aging date and apply it to a multiple If statement. I tried a joining field, but it's not working. A simple multiple If statement should do the trick though.

If AR is:
0-10
Then return:
"Current AR"

If AR is:
11-40
Then return:
"001-030"

If AR is:
41-70
Then return:
"061-090"

There are more, but I can figure that part out once these are solved. Any help would be appreciated.

Thanks,
Jason

View 3 Replies View Related

Modules & VBA :: If Statement With Multiple Criteria

Apr 14, 2015

I'm trying to create a report that does the following:

If the term "Other" is selected in the Time1 field, then the Time1 field will not be visible, but the field Other1 field will be visible and if the term "Other" is not selected in Time1 field, then the Time1 field will be visible and the Other1 field will not be. This is what I have for VBA code, but it is not working.

If Not IsNull(Me.Time1) Then
If Me.Time1 = "Other" Then
Me.Time1.Visible = False
Else
Me.Time1.Visible = True

[Code] ......

View 6 Replies View Related

Modules & VBA :: Multiple Criteria For Where Statement?

Feb 25, 2015

I am creating a report that has a filter based on 3 separate listboxes. The user has the option of choosing one or more filter criteria from each listbox. The trouble I am having is if the user only chooses one filter, I need to adjust my filter string. This is the code that generates the filter:

Code:
strWhereFinal = strWhere1 & "AND " & strWhere2 & "AND " & strWhere3

You can see that if strwhere1 is NULL, the string will start with "AND [ApplicationStatus] = 1" and will obviously cause a failure.

Is there a simple way to build this string based on the number of search strings that are not null?

View 2 Replies View Related

How To Link Subforms To Other Subforms On An Unbound Form

Feb 4, 2006

I forum could someone tell me:

I have an unbound form on that form I want to put three sub forms one on a products table the other on a course start dates table and the link table that joins the other two together. all three are related to each other with Pk/FK links.

When I try to link them it says you cannot link items on an unbound form.

regards in advance
Peter:eek:

View 1 Replies View Related

Modules & VBA :: Syntax On Multiple Criteria In Where Statement

Dec 10, 2014

I need to get this syntax right. I have something similar that worked before to open a report but now I am using the same code structure on opening a form and I can't get it.

[prikey] is an autonumber and that has given me trouble before with the syntax. [EstimateFlagCleared] and [WarrantyFlagCleared] are Yes/No fields.

Dim maxFlag As String
Dim flagCriteriaWarranty As String
Dim flagCriteriaEstimate As String

[Code] .....

View 13 Replies View Related

Modules & VBA :: Multiple Variables For Insert INTO SQL Statement

Sep 28, 2013

Look at the below SQL 'INSERT INTO' statement ? I'm trying to insert multiple variable values into an 'INSERT INTO' statement. I'm getting the below error message. The code is listed below. I started out with two (2) variables, but will have thirteen to insert into a table. Also, in the code below is the VBA statement to retrieve the variable data. I'm getting the data, but cannot insert the data into the table.

Private Sub Test2_Click()
Dim strSQL As String
Dim strSalesman As String
Dim strContentArea As String
DoCmd.SetWarnings False

[Code] ....

Error
Microsoft Visual Basic popup
Run-time error '3061'

Too few parameters. Expected 1.

View 5 Replies View Related

Queries :: IIF Statement That Would Change Value To Multiple Fields

Oct 15, 2013

I have a problem that I can't seem to solve in SQL for my access 2010 query.

Let's say I have a the price of and for every year.

In the tables I have A building number, a building type, and electricity and water predictions for this year and many upcoming years (up to 40 years)

I need to apply a change to any building with the building type BRT to show only 10 percent of the electricity and water for ALL years (up to year 2052). So building 5 would show 8.5, 5.4, 9.5, 7.4, and so on.

View 2 Replies View Related

Forms :: How To Break Update Statement Into Multiple Lines

Mar 7, 2014

I am unable to break the UPDATE statement into multiple lines and now I am getting "Syntax Error in UPDATE statement"

Following is the multiple line Update Statement

Dim strsql As String
strsql = "Update tblcurr" & _
"SET tblCurr.Currencyname =" & _
"[forms]![updatecurrency]![txtcurname]" & _
"WHERE (((tblCurr.Currencycode)=" & _
"[forms]![updatecurrency]![txtcurcode]));"
DoCmd.RunSQL strsql

Following is the one liner Update statement which, works perfectly

strsql = "UPDATE tblCurr SET tblCurr.Currencyname = [forms]![updatecurrency]![txtcurname] WHERE (((tblCurr.Currencycode)=[forms]![updatecurrency]![txtcurcode]));

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved