Forms :: 2 Lookup Controls On One Subform

Aug 13, 2013

I have a library database with a form called Author and a subform from a junction table. The junction table connects Title/Genre. It's many to many because I usually have a few genres for one book.

This is my problem. I want to add more information to the subtable that is in the junction table. For every record I would like to add also Book Group (I am a member of several groups and want to remember which one I read the book with) and Purchased From.

So I am assuming I have to have 2 lookup controls to be able to add Book Group and Purchased from since neither one is on the junction table (and they both come from tables). Or do I add them to the junction table?

View Replies


ADVERTISEMENT

Forms :: Referencing A Subform Controls From Another Subform

Apr 15, 2014

I have a form with four unlinked sub forms on - I am hoping to

1) add a value from one subform to another and more importantly

2) update 1 subform when the other is amended...how exactly do I reference subform 2 from subform1.

I have tried me.parent!form2 and forms!mainform!form2.requery etc but can't get it right

View 7 Replies View Related

Forms :: Looping Through Subform Controls?

Aug 16, 2013

I have a main form, lets call it FrmMain. In addition, I have a subform on FrmMain that has a tab control on it (frmSubform). What I would like to do is on form load, reference the tab control that is on the subform, loop through the controls/textboxes, lock them and change their backcolor. The code I am attempting is listed below, however, I am getting a "type mismatch error" highlighting this line:

PHP Code:

Set Frm = Forms!frmConsultingMain!FrmConsultingFeeData 

Below is my code:

PHP Code:

Dim ctl As ControlDim Frm As FormSet Frm = Forms!frmmain!FrmSubformFor Each ctl In Frm.Controls    
If (TypeName(ctl) = "Textbox" Or (TypeName(ctl) = "combobox") Or (TypeName(ctl) = "listbox")) Then        
ctl.Value = Null        ctl.BackColor = vbYellow        ctl.Locked = True    End IfNext ctl 

View 10 Replies View Related

Forms :: Conditional Formatting Of Controls In A Continuous Subform (Access2007)

Aug 28, 2013

I have a continuous subform with multiple controls (textboxes) per row.

I'm trying to set up conditional formatting such that certain textboxes are highlighted based on comparisons with other textboxes within the same row/record.

What's bothering me is, I have managed it for one, but struggling to do it for others!

For example - I want to highlight 'similar' records (i.e. possible duplications) - and have managed this by adding a textbox across the length of the row and applying the following CF expression :

Quote:

DCount("[ID]","[tblMyTable]","[ID] <> " & "txtID" & " And [Field1]=" & "txtField1" & " And [Field2]=" & "txtField2" & " And [Field3]=" & "txtField3" & " And [Field4]=" & "txtField4" & " And [Field5]=" & "txtField5")>0

Works brilliantly - highlights all records where fields 1 thru 5 hold common values.

Now I want to highlight where two fields within the same record are different (i.e. they are driven by different data but should hold the same value)

Am trying this :

Quote:

"txtField3"<>"txtField4"

But it's not working - it's highlighting pairs of fields even though they do hold the same value.

Even tried switching it for a DLookup (which seems like doubling up on effort, but just to see if it worked)

Quote:

DLookUp("[Field3]","[tblMyTable]","[ID]=" & "txtID")<>DLookUp("[Field4]","[tblMyTable]","[ID]=" & "txtID")

But no dice? I can't figure out why the same basic logic which works so well for the first CF, doesn't hold for the second one.

View 5 Replies View Related

Forms :: Locking Main Form Controls Causes Data In Subform To Disappear?

Dec 12, 2014

So I am creating a Complaint Tracking Database with Access 2013. In my 'complaint entry form' I have added to ability to "Open" and "Close" the complaint. While the complaint is open the user is able to enter/edit data in the complaint (new or old). When the complaint is "Closed" (done so with a button on the form that prompts the user to enter a date of their choice) the user should not be able to enter/edit data in the given complaint. In my original thinking, I placed checks on various events (on load, after update, on click) that checked to see if the current complaint had a date in the "Close date" field.

If the close date field was null then that meant that the complaint was open and the the controls would NOT be locked. If the close date field was NOT null (i.e. a date was present) then the complaint was closed and the main form fields were locked but the data was still viewable and unless they "re-opened" the complaint they could not change the data.

Now, in the complaint entry form, I have a subform that acts as a action tracker that is used by the user to keep track of the actions taken on the complaint (i.e. they requested documentation from such and such on this date..etc). My problem through all of this is upon closing the complaint and locking the main form controls, my subforms data just vanishes! At first I figured the problem might be with the linking of master and child fields, so I made sure that I left the ID in the main form unlocked when I loop through my controls during the locking process. This did not solve my problem. Code below:

Private Sub Form_Load()
Dim ctl As Control
If Not IsNull(Me.close_date) Then
Me.FormHeader.Visible = True
Me.btnClosed.Enabled = False
Me.btnOpen.Enabled = True
For Each ctl In Me.Controls

[Code] .....

View 3 Replies View Related

Forms :: Combo Box Within Subform That Use Lookup Queries

Jun 18, 2014

I have two combo boxes in a subform that use lookup queries. I can get the combo boxes to work correctly out of sub form in a regular form but can not get the combo boxes to work in the sub form. I have narrowed the issue to the logic in the queries in the secondary and tertiary combo box queries. Here is the part of the secondary query. I think I have to add the primary form name to this part to correct my issues. How would I do that?

primary form = Lookup_fm
sub form = master_tbl_sub_fm

IIf(IsNull([forms]![Master_tbl_sub_fm]![Role1]),[P_ID],[Forms]![Master_tbl_sub_fm]![Role1])

View 1 Replies View Related

Forms :: Hiding Columns On Subform Based On Multi-Value Lookup Field

Aug 7, 2013

I want to use VBA to hide columns in a subform based on what is checked in a multi value look up field.

I am creating this DB for use with sharepoint as a web database, which is why I am using the lookup field to begin with. There will be a client DB to use with some VBA code

So what I have is a lookup field with tests "Test 1, Test 2, etc" on form sample.

There is a subform called results, and I want to hide certain columns based on what tests are performed.

I tried using an If Then statement (code is being run on subform load)

If Me.Parent.fieldTest = "Test 1" Then
Me.Test1Col.ColumnHidden = False
Else Me.Test1Col.ColumnHidden = True

That is basically the code I was trying to use. I am getting an error 13, which I assume is because fieldTest can not = something since it is a multi value look up field.

View 3 Replies View Related

Referencing The Controls On A Subform...

Feb 16, 2007

Hello,

I need some help with a piece of code for a db.

This code checks to see if the last three characters on a ControlSource.Tag property are "Req" and if they are, tests if it's null or = 0 and if it is then it outputs a msg box stating that the control.ControlSource is required. It does it for every control on the main form.

This has worked.

Now, i need to allow for multiple subforms to be located on the main form along with their controls being tested as well. I want to start another loop for each time the conrol on the mainform is a subform.

I have that done so far by using "If TypeOf ctl Is SubForm Then..."

This is the part i need help with. I want to search all of the controls on the subform when it is a subform. I need to search all of the controls on the subform then, and i'm not quite sure of the syntax.

I've tried various somethings like SUBFORMCONTROL.Controls but that hasn't seemed to work...

If someone could help me, that would be wonderful!

View 4 Replies View Related

Subform Controls Not Allowed?!?!?!?!

Jan 24, 2005

Hello,
my problem looks so stupid, but I'm not able to solve it..
I've a form with two subforms in it and one of them is behaving in a strange way.
I open the form and type something in a text box in the form. Now I can type something else in a text box in the first subform but I'm not able to write anything in a textbox in subform n°2. It's textboxes (and also other controls like combo,...) look like they are not enabled (but they are enabled!!).
This subform has also got a Button, and it works (It deletes current record).

If I close the form and reopen it and I go straight to subform n°2, now I'm able to insert text in it's controls, but I'm not able to edit the controls in the main form and in subform n°1.

I hope my problem is clear
Please help!!

View 1 Replies View Related

Controls On Subform Disappear

Mar 31, 2005

Well this is going to take a bit of explaining, because my colleagues and I are totally baffled.

I have an Access 2000 front end connected to a Sql production server. I went to make some changes to my forms and subforms, but I did not want to do it with the live data. So I made a copy of the database to my own Sql server on my desktop. So far so good . . . Now when I opened my main form, my subform appeared, but its controls were invisible--I still had not touched the code.

I looked at all the properties for my form and subforms and it is set to Visible and Display always. Now, even stranger, when I advanced my records, if the subform had data its controls would become visible, and then disappear again when I reached a record that had no data for the subform (the main form and the subform are bound to two seperate tables within my database, all the subform controls are bound as are the majority of the form's controls).

Then I went to the code. Nowhere do I change the Visible related properties within the form/subform code. I decided to put a Stop in the Form_Current code of the subform and see what happens as I advance from record to record. What happened was that when I reached a record with subform data present the stop would be read and I would toggle through the Form_Current code. When I would reach a record with no subform data, the Form_Current code would not be read as evidenced by there being no Stop action.

Anyone have an idea of what's going on? Something gets changed when I connect to my local SQL server. Even when I reconnect to the production server the problem remains. Its like some property changes, although I cannot find it, and it is changed permanently. The only property I play with by code is that I enable the controls of the subform when there is NO data in the subform, and I disable the controls when there is data. This code follows:


Private Sub Form_Current()
On Error GoTo Err_Form_Current

If Me!AssignedNumber = True Then
Me!AssignedNumber.Enabled = False
Me!txtWTNumber.Locked = True
Else
Me!AssignedNumber.Enabled = True
Me!txtWTNumber.Locked = False
End If

Exit_Form_Current:
Exit Sub

Err_Form_Current:
MsgBox Err.Description
Resume Exit_Form_Current


End Sub


Finally I tried to set Visible to true within my code for the individual controls, but that still did not overide the problem. I connect to my server via an ODBC connection to a .dsn.

Thanks in advance for bearing with me,
Tony

View 1 Replies View Related

Subform Controls Are Invisible

Jul 13, 2006

I have a subform (in form view) in a form that is used for data entry. When I open the form the subform is blank except for the navigation controls. The navigation controls are disabled though. If I switch to datasheet view I will see the column headers but there won't be any place to type data (no white boxes). This doesn't happen if my master and child fields aren't set up, but obviously that will show the wrong data and create other kinds of entry problems. Right now the tables are empty so that could be part of the problem, but I shouldn't have to manually enter a record so my form will look right.

View 12 Replies View Related

Access A Controls Value In One SubForm From Another

Jan 26, 2005

Hi,

I have two subForms on separate pages of a Tab Control on a main form. I want to create a Textbox on one Form to display the month of a Date field on another form, using DatePart.

Using the On Current event, this works ok, if I have the 'other' subForm open in its own right, but I get message telling me it can't be found if i don't. Here is what I have...

Private Sub Form_Current()
If Not IsNull(Forms![Reviews]!SelectLessee) Then
Dim revDate As Date
revDate = Forms![subReviewPEST]!DateOfNextCreditReview
Me.Text118.Value = DatePart("m", revDate)
End If
End Sub

What syntax do I need, or how then can I access the control without having the subForm open itself, by getting to the page on the tab control, then to the control on the subform...

View 2 Replies View Related

Tab Controls On Subform For Sequential Records

May 19, 2006

I have a form with 3 tabs...each tab has the same subform embedded in it.

There are 3 sequential records in the database, and my desire is to have each record display on its' proper tab.

How can I set filter criteria for each subform to append the record sequence identifier to the link master/child fields to ensure that only the appropriate record displays on each tab?

Basically, I trying to use tab controls with embedded subforms to display the many side of a one to many relationship. The parent form contains the data for the parentrecord, and I want the subform, with a tab for each related record, to show the child side of the data relationship. One child record per tab, utilizing the same identical sub-form for each.

View 1 Replies View Related

Lining Up Controls On Main Form And Subform

Oct 1, 2015

I have some controls that I want to line up. Some are on the main form and some are on a subform. My questions is how do I do it? I normally

Select all of the controls then click on align and align top and left. Will that work here?

Again some controls on main and rest on subform.

View 3 Replies View Related

Modules & VBA :: Delete Records From A Table Using Controls On A Subform

Jun 20, 2013

I have a sub form that allows users to add staff to a project team, once added it populates a table which updates the subform showing the selected employee. I am trying to enable a delete function that allows users to remove an employee from the project team in the subform showing selected staff. Here is the code I have so far, but it doesn't work;

Code:
Private Sub Command4_Click()
Dim dbs As Database
Dim rs As Recordset
Dim sqlstr As String
Set dbs = CurrentDb
sqlstr = "DELETE tbl_CapexStaff.* FROM tbl_CapexStaff WHERE CAP_ID = Forms!frm_Switchboard.CAP_Live"
dbs.Execute (sqlstr)
End Sub

View 4 Replies View Related

Modules & VBA :: Reference Field On Datasheet - Unbound Subform Controls

Jun 2, 2014

I have placed an unbound subform on a form. I have the following code which loads in different datasheet to the subform:

'Loads in NewQuery
Me.data.SourceObject = "query.NewQuery"

'Loads in NewQuery2
Me.data.SourceObject = "query.NewQuery2"

etc.... this works fine to show these queries but i want to know how to reference the fields on the datasheet.

for example one of the fields in NewQuery is "ID"... When clicked i want to run code... normally on bound subform i could go for example ID_Click()... msgbox(me.ID)

how can i reference these other fields on unbound???

View 3 Replies View Related

Modules & VBA :: Hide Subform Footer Controls If No Records Present (AC2007)

Mar 14, 2014

I have a subform which lists a set of records. In the footer section of the subform, I have a number of controls which display calculations based on the records present.

The number of records in the subform will change (reduce). Basically, this is a review / approval function, the idea being that each record will be checked and approved, which will then remove it from the list.

So eventually, all of the records in the subform should disappear (the subform is requeried each time the user approves a record)

I want to be able to hide the controls in the footer section once the subform has been cleared of all records.

But not sure

a) how to determine when the subform's recordset reaches zero and

b) what event to use to fire the code to hide the footer controls.

This is my basic attempt :

Code:
Private Sub Form_Current()Dim ctl As Control
For Each ctl In Me.FormFooter.Controls
ctl.Visible = Not (Me.Recordset.EOF)
Next ctl
End Sub

But it doesn't work (it only seems to fire when the subform is loaded, not when it is requeried after each approval?)

I've tried Form_Query, Form_DataChange and Form_DataSetChange but no joy with those either.

View 6 Replies View Related

Combo Box Subform 'Reverse Lookup?'

Jun 9, 2006

I have two tables A and B. There is a 1 to many relationship between A and B. Table A's data is controlled by FormA, Table B's data is controlled by FormB which is a subform on FormA. I already have a combo box for navigation on FormA, however I would also like to be able to have a combo box on FormB (FormA's subform) for navigation, so that when I choose an record from the subforms (FormB) combo box, FormA then jumps to the 1 record from FormA that contains the related record choosen in the SubFormB's combo box (along with the subforms choosen record on the subform) .

Kindalike the combo box on FormA, except it's a 'reverse lookup' if that makes sense. Is this at all possible, does this even make sense? :confused:

_______________
HOLY CRAP BATMAN!!!

View 2 Replies View Related

Subform In A Form Doesn Show Controls When Link Child And Master Fields Derfined

Jun 13, 2005

Hello,

I have a form and a subform in MS Access 2003. I have made some changes to database structure, so I decided to change the subform also. When I changed the Link child and link master fields, the controls of the subdatasheet dissapear- they show only in design view. If I clear the contents of Link child and link master fields they appear again, but the records are not binded.
Is there a setting on the parent form that also has to be changed, to make the new binding?

Thanks,
Aleksander

View 1 Replies View Related

Modules & VBA :: Undo Method When Using Form And Subform / Lookup Tables

Feb 3, 2015

How come its so hard to create an undo method when using a form and subform, lookup tables and tiered selections in combo boxes?

View 3 Replies View Related

Tab Controls - Two Forms

Jun 2, 2005

Hello,

I want to use a tab form where the user can click add, search, and edit records all from 3 tabs. The problem is I only want to be able to add data on one form, edit data on another, and just read only on the search. This seems to cause a dilemma, how can I specifiy them to add, edit, and read only on one form using tabs?

Mateo

View 1 Replies View Related

Forms :: Dynamically Resizing Forms And Controls

Oct 31, 2013

I am making a database that will be used by multiple people on a network, and they have different resoloutions on their own computers. when the database is loaded on their respective computers, the form controls are all off.

On the computer i designed them on, the forms fit perfectly on screen, as do the controls, i would like to know if there is some vba code i could incorporate into the form open event, or module code that i can use in order to dynamically re-seize the forms and all of the controls to suit different resoloutions?

View 6 Replies View Related

Referencing Controls On Forms

Mar 30, 2012

I have a main form, 2 sub forms, and 2 text-boxes on the main form. I have a search box now for the first subform. Works perfectly. Once the users filtered based on name, I want them to be able to select that filtered record which would filter another subform.

Right? ok.

My first attempt was to assign the ID that was selected to a textbox on the main form, then automatically requery the second subform based on that value. I used this way on my search box. I'm sure there is a way to go directly from clicking the value to requerying the second subform, but i don't know it.

That being said even the indirect first attempt isn't working. It all has to do with the ".", "!", and ordering of this stuff. It has to do something with Parent child, but beyond that I'm at a loss.

Code:
Me.[Collateral] = Acct_Reference_id
Me.[Navigation]![textbox] = Acct_Reference_id
...
'Me!Subform1.Form!ControlName
'Me!Subform2.Form!ControlName
'Me.Parent!ControlName

I did find this very useful site [URL] ...... It shows what code you can use depending on where you are and what you're doing. Even with that as a resource, i'm still at a loss.

View 7 Replies View Related

Remove Controls On A Forms' Opening

Sep 29, 2006

Hi there,

I've been puzzling over this one for a few days. I've done a few searches on here to borrow some code - but the fact is I don't understand how to implement the suggestions. I'm hoping somone can help.

Basically, I have a form for editing the database, however, there are a number of reasons for opening this form - so at the moment I have several copies of the same form all with very minor changes. In order to streamline the way I've done this, I'd rather have controls always call up the same Form - but state in their code whether or not certain controls on the editing form are visible or not...

:mad: :eek: :mad: :eek: :confused:

It's all gone rather Pete Tong here. And I must admit I'm button bashing the code a bit now. Basically, when a button is pressed, I want it to load the form "frmEditJob". Depending on what I want visible, the Tags "N, M and V" will activate and deactivate certain controls on "frmEditJob".

With me? :confused:

Any help is appreciated!

Cheers.

Private Sub EditJob_Click()
On Error GoTo Err_EditJob_Click

Dim stDocName As String
Dim stLinkCriteria As String


If IsNull(Me![IDEntry]) Then
strMsg = "You need to enter a Valid ID number in the box provided."
strTitle = "ID Number Error"
intStyle = vbOKOnly
MsgBox strMsg, intStyle, strTitle
Exit Sub
End If

stDocName = "frmEditJob"
Dim ctl As Control

stLinkCriteria = "[WorkorderID]=" & Me![IDEntry]
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria


If ctl.Properties("Tag") = "N" Then
ctl.Properties("Visible") = False
Else
ctl.Properties("Visible") = True
End If

Exit_EditJob_Click:
Exit Sub

Err_EditJob_Click:
MsgBox Err.Description
Resume Exit_EditJob_Click


End Sub

View 5 Replies View Related

Forms- Subtable Filtering Controls

Apr 28, 2008

Hi,

I'm new to Access and am having trouble designing a database that houses application details.

All applications have a list of unique wrap id's but have different tables housing different details for these wraps.

I have a main table which is for data entry and lets me input whether or not a piece of software is Vista compatible (yes/no) etc.

I also have a field in this table showing which analyst is responsible for researching compatiblity of an application.

I have another table with different regions i.e. london, manchester etc that has the region/city listed as the field heading and then contains a list of wraps used in that city under the relevant field.

My main entry form is linked to the main data entry table that holds specifics for an app, name, vista compatible etc. This form is used for data entry. I want to add a subform on this form which shows a list of all applications, in table format, but I want a drop down list so I can select an analyst name / region so that analysts can update details for a specific area assigned to them. In the table I want all of the records based on this criteria to be displayed.


I guess I need to make a filter button on my subform but do not know how to do this. I put in a button control for apply filter by form but then dont know what to do.

I'm new to access and don't know much VB - e.g. the only thing I can do in VB is a make a message box that says hello world on the screen.

Any help is sincerely appreciated. Apologies for the Essay.

Kind Regards
Bal

View 7 Replies View Related

Forms :: Controls Not Repainting After VBA Routine

Jul 23, 2014

Access 2007

I have a subroutine which cycles through all controls on a form, and for controls with applicable tags, either enables or disables the control.

The routine accepts a form as the parameter (frm), and is called from a button on the form itself.

Despite trying frm.repaint in the generic routine, and, me.repaint from the calling form, the controls do not seem to repaint until the mouse moves over them. A command button, for example, will be grey-ed out, despite being enabled, but will un-grey when the mouse goes over it.

View 8 Replies View Related







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