Modules & VBA :: Open Form Based On Subform ID?

Mar 7, 2014

I have a form (frmSearch), based on (I think) John Big Bootys code. On it, a search box, which filters results as you type. Works great.

Instead of presenting the search results in a listbox, I wanted it in a subform (sfmSearchresults). Also works great.

Problem was this: I wanted a button on this form, to open another form based on [CustID]. For a listbox, I could use columns(0), but not for a subform. After much trying I got this to work:

Code:
Private Sub cmdVisaPren_Click()
Dim strWhere As String
strWhere = "[CustID] = " & Me.sfmSearchResults.Form.Controls.Item(5)
DoCmd.OpenForm "frmAddCust", acNormal, , strWhere, acFormEdit, acWindowNormal
End Sub

The part that I don't understand is the Item(5). The subform is based on a query (qrySearch), from tblCustomers. tblCustomers fields is as follows:

CustID, FirstName,LastName,Adress1,Newspaper1,Newspaper2.

Item(0) in strWhere would return Adress1 as [CustID].
Item (1) = Newspaper1, Item(2) = Newspaper2, Item(3) = FirstName, Item(4)=LastName, and (finally) Item(5)=CustID.

I don't get the logic. With listboxes, I could just count columns for columns().

Have attached my database. It's just a test database, with 4 people. The final database will have about 1200 people, and many more fields. Its .accdb (Access 2013). I tried converting to Access 2002-2003, but couldn't get it to work.

View Replies


ADVERTISEMENT

Open Subform Based On Form With Combo Box

Oct 27, 2005

I have a main form (FRMProspects) with a combo box (ComboCoName) that has a query as it's record source to sort the records displayed in it. It is bound by the CustID (autonumber), but displays the CompanyName.

What I want to do is open a sub form FRMNotes, based on the Company name that is selected in the ComboCoName. So for Company XY, I want to click on the Notes command button to open up all the notes for that company only (filtered). FRMNotes is based on a different table, but TBLProspects and TBLNotes are linked by CustID (one to many).

What code do I need for this? I am treading water with VBA!

View 4 Replies View Related

Modules & VBA :: Open Report With Subreport Based On Unbound Form

Apr 14, 2015

I am trying to open a report (rptGMX-IRG) that includes a sub-report (srptRG) based on criteria that is set with two unbound fields on a form (frmGMXbook). This form has two dropdown boxes (cboGMX_No & cboMachSize) and a command button. The first dropdown box includes data located in the main form and the second dropdown includes data that is part of the sub-report.

I can get the report to open properly when I enter data into both fields on frmGMXbook.

However, the problem I am having is the inability to have one or both fields be "Like '*'" and show all associated records.

Here is the code I have on the command button.

Private Sub GMX_Preview_Click()
Dim strCriteria As String
If IsNull(Me.cboGMX_No) Then
strCriteria = "[cboGMX_No] Like '*'"
Else
strCriteria = "[GMX_No] ='" & Me.cboGMX_No.Value & "'"

[Code] ....

View 1 Replies View Related

Modules & VBA :: Subform DS Click Field To Open Tab On Another Form

Apr 19, 2015

How do I reference a subform DS field to open up a tabbed form on another subform.

Here's what I have.

field one on the Sub DS opens up tab one on another form, as does field two on DS open tab two on another form.

but..

how can I click on "any" field on the DS, run an IF statement, and it checks if that record on the Datasheet, contains information in regards to, IF field one OR field two contains any data, and opens the tabbed form respectively on the other form?

View 3 Replies View Related

Modules & VBA :: Subform Requery Not Working On Form Open

Apr 3, 2014

I have a form with two subforms. One subform is a datasheet that pulls data from a temp table. During the other subforms Form_Current, the temp table is emptied (DoCmd.RunSQL "Delete from tblAddRefs"), reloaded with data relevent to the current record, and requeried (Forms("frmEDFP").Controls("tblAddRefs subform").Requery). This works like I want it to...

With the exception of the initial load of the main form. The subform based on a table shows (#Deleted) instead of data. if I step through the code, I can see that the temp table is emptied and repopulated by the time I try to requery the subform. This is still happening during the Form_Current of the other subform, which is successfully running on main form load.

If I requery (Forms("frmEDFP").Controls("tblAddRefs subform").Requery) using a button on the main form once it is loaded, the #deleted data is correctly is replaced by regular data, so it's like the requery in the Form_Current event isn't doing anything during load.

View 2 Replies View Related

Open Subform At Certain Recordset Based On Subform

Feb 5, 2005

I have a main form which has a subform control in it. when the main form is opened the sub form control contains a list of events in a sub form (a summary view), for the person selected in the main form.

I want to change the subform to a different one which shows the whole event when i click in a field on the subform, based on the event i clicked in. ( i can do it by opening a new form but not with a new subform)

I can make the form change using the following code:

Private Sub Notes_DblClick(Cancel As Integer)

Me.Parent.subformhere.SourceObject = "eventsfullrecord"

End Sub

What code do i need to make it open to the record i clicked in the summary form, rather than just opening to the first record every time?

Not very good at passing recordsets

Thank you

View 4 Replies View Related

Modules & VBA :: Subform Calculations Based On Parent-form Data?

Jul 17, 2013

I have a form with a subform in a navigation menu. Something like:

Navigation Form
NavigationSubform
ParentForm (header data and some unbound calculation fields)
Subform (Multiple lines tied to query)

I have some fields in the ParentForm (i.e PF1, PF2) that would effect the values on the Subform (i.e. SF1, SF2). Also, there are some user editable values on the subform that will calculate the remaining fields on the subform (still using data from parentform).

My calculations work fine for the changes made on the subform. However I need to be able to calculate all the children lines on the subform when the form loads or a change is made to certain fields on the parentform. My On_Current event only wants to recalculate the first line.

Parent Form
PF1=10
PF2=3
Subform QTY ADJ SF1 SF2
Line 1 5 .05 10.6 112.89
Line 2 8 .14 10.38 105.15
...
Line N
SF1=PF1+(PF2/QTY)
SF2=SF1*(SF1+ADJ)

So if PF1 or PF2 were changed then all the lines is subform would recalc SF1 and SF2. If changes were made to QTY or ADJ, then that line would recalc SF1 and SF2.

View 3 Replies View Related

Modules & VBA :: Filter Subform In A Form Based On Date Range

Jul 26, 2015

So I have a search form that I created that has also a subform (a continous form, that has a query as its source) where my records are listed. I started on making a Between dates filter where i would be able to pick dates and get the results of records that are in that range.

I put two text boxes in which I set format to Short Date so that I get the button to select the date from a calendar for each text box. Then I made a button that is only for this and added a Clickon code so that it filters my subform over the recordsource of the form. The problem is is that i get an error and it doesn't filter.

Code:

Private Sub btnDatumUpis_Click()
Dim SQL As String
SQL = "SELECT qrySearchV.VID, qrySearchV.MarkVoz, qrySearchV.ModelVoz, " _
& "qrySearchV.TipMot, qrySearchV.Regist, qrySearchV.VlaVoz, " _
& "qrySearchV.KorVoz, qrySearchV.KatV, qrySearchV.DatumUVoz, " _

[Code] ....

View 5 Replies View Related

Modules & VBA :: View Main Modal Form Based On Chosen Subform Record

Jul 22, 2014

I have a modal form which has a single record which is then linked to a sub-form on the same modal form. This all works fine and shows the relevant record and sub records but I want the modal form main record to change dependant on the record selected in the subform (which is basically order item history.

I found some code on another site which seemed to work for others but for me I am getting Run-time error 2465 and it doesn't like my reference to 'Me' - is this because it is a modal form?The code I am using is:

Public Function GotoRecord(RecordID As Long)
Dim rst As DAO.Recordset
Dim strCriteria As String
Set rst = Me.RecordsetClone
strCriteria = "ID = " & RecordID
rst.FindFirst strCriteria
If rst.NoMatch = False Then
Me.Bookmark = rst.Bookmark

[code]....

View 1 Replies View Related

Modules & VBA :: Open Drop Down Box On Subform

May 3, 2014

I want to open the dropdown box on my datasheet view subform from the main datasheet view form when I run over it with the mouse.From my main form textbox [WelderID]I tried this code but doesn't work. I get the error invalid reference to the property Form/Report.

Private Sub WelderID_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
Forms![Main]![WorkOrder Form]![DrawingNo fm]![Welds fm]![WelderStamp Sfm]![WelderStamp].SetFocus
Forms![Main]![WorkOrder Form]![DrawingNo fm]![Welds fm]![WelderStamp Sfm]![WelderStamp].Dropdown
End Sub

I am not sure if there is more code to use to open the subform in the datasheet view.

View 2 Replies View Related

Modules & VBA :: Search SubDirectory - Find And Open A Folder Based On Text Box

Sep 8, 2014

I am 2 years into my database. I am trying to find and open a folder based on a text box. The problem is folder could be in many sub folders which is hold on our J: drive.

To further complicate, the folder i am searching may not be exactly as the text box states.

EG. Text box could say 123456 however the folder could be called M123456 etc.

How do i locate a folder or subfolder and open it based on part of a text box...

View 3 Replies View Related

Forms :: Button In Form To Open Different Form And Chose A Customer Based On Last Form

Mar 26, 2013

Basically I have a Customer Form, which I have a New party button on it,this button opens up the party form to a new party, what I would like it to do is open up a new party but make the new party for the customer I had selected in the previous form.I have tried the GoTo macro's but cannot seem to get it to work.

I am thinking on clicking the button it will need to get the Customer ID, and then open the party form, create new party, and paste in the Customer ID, which then updates the Name - Date - Address - Company Fields.

View 5 Replies View Related

Forms :: Open Blank Form Based On Value In Text Field In Main Form

Jun 6, 2013

I have one table containing name of restaurant with its address etc. Then i created another table to list out the restaurant workers names and details. Just as an example,

Table:Restaurant
Restaurant name
Address line 1
Address line 2
Restaurant #
Website

Table:StaffContact
Staff Role
Name
speciality
email
phone

I have the main form that has all the restaurant details only. And i have another form containing the Staff information. Please note the two table have a relation and it works well.

Now to make it user friendly(basically easier for the lazy ones), I dragged the staff contact form on to my main form and displayed it as a datasheet(basically a sub form).

Now, my boss does not want users to add/delete on this sub form(datasheet). So,he wants me to create buttons to open new record of staff for each restaurant(new form)

My issue is with opening a new record to enter a new person to the staff list and give them a role as well in form view.The new form has

So i ran a Macro, with open form with Where condition

Code:
[Staffcontact]![Rest Name]=[Forms]![MainForm]![RestaurantName]

But, it does not work .

View 2 Replies View Related

Open Second Form Based On Info In First.

Feb 2, 2005

I have a Form1 that is based on a select query with a criteria [Enter PIN number]. When we enter the PIN it returns the correct result. I want to have a button that opens a second form based on the same PIN number entered to open the first (in fact there will be numerous forms I want opened based on this PIN).

Example:

Sidewalk - button
Curb X button
Tree - button
Hydrant X button


In the example above, only CURB and HYDRANT returned an entry. Therefore when I click on the button next to CURB I'd like the frmCurb to open showing the data based on the PIN numbered entered to open the From1, and when I click on the button next to HYDRANT it would open frmHydrant showing the data for HYDRANT based on the same PIN number entered to open the Form1.


Thanks,
SKK

View 12 Replies View Related

Open Form Based On Value From A Listbox

May 19, 2006

Hello !

I am a newbie in access and would appreciate if someone could help me with a delicate problem i have

I have listbox in formA named "Liste1", this listbox contains a departmentvalue (unique) in the first column shown in the listbox.

What i want to do is open a new form (frmStructureDetails) by doubleclicking on the listbox, and i want the new form to load with filter on that department. Btw the departmentvalue is textformatted.

The result i get is a dialoguebox opening and not seeming to recognize which value to use, if i fill inn the value i clicked on the form loads with the correct data.


What am i doing wrong:

Private Sub Liste1_DblClick(Cancel As Integer)
On Error GoTo Err_SearchList_DblClick
Dim db As DAO.Database
Dim rst As DAO.Recordset

DoCmd.OpenForm "frm_StructureDetails", , , "[Department] = " & Me.Liste1


Exit_SearchList_DblClick:
Exit Sub

Err_SearchList_DblClick:
MsgBox Err.Description
Resume Exit_SearchList_DblClick

End Sub

View 1 Replies View Related

Forms :: Open A Form Based On Current Form?

Nov 23, 2014

When I have a form called "SiteForm" open and click a button "NewCalloutButton" I would like it to open up a form called "CalloutFormEntry"

I've done this using

Private Sub cmdOpenDetail_Click()
DoCmd.OpenForm "CalloutFormEntry", , , "CalloutID = " & Me!CalloutID
End Sub

However this brings up all the records linked to the calloutID

What I'm after is to open the CalloutFormEntry from the SiteForm in a dataentry kind of format but to carry over the current SiteID based on which site is open on the SiteForm. That way there's no user error logging callouts to incorrect sites.

View 9 Replies View Related

Open New Form Based On Listbox Selection

Oct 25, 2005

I have a form which has a listbox listing all the letters a student has had sent home. Basically i want to be able to click on a letter in the list box and for a popup form to open with the record details. However it just brings up a blank record.

The list box has a unique field called standardletterID.

the code behind the button to filter was just used through the wizard to open the popup form is:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmstandardletterspopup"

stLinkCriteria = "[StandardLetterID]=" & Me![List0]
DoCmd.OpenForm stDocName, , , stLinkCriteria

but it doesnt seem to be working :(

I thought this would be easy but no matter how much i destroy my database trying to do it its not playing ball!

View 1 Replies View Related

Forms :: Open Another Form Based On ID If No Records

Apr 9, 2015

I'm working on a database for residents at a care home. I've just started and I want to automate a process where I can click a button and see the contact details of a GP. It's all working but I want it to be that if the resident has no GP it will open a form so you can choose a GP. I have a message box to tell the that the resident has no GP and it takes them to the relevant form but I need it to be based on the correct residents ID and it is not. I have the code running on form load. I have attached a zipped version of the database (it is safe I promise)

View 5 Replies View Related

Use Hyperlink To Open Form Based On Value In The Field?

Jun 12, 2014

I have a continuous form that lists all unapproved invoices. I would like to have a hyperlink at the end of each row that says Review and will open another form that queries the details of the unapproved invoice based on the invoice number in the current row.

View 9 Replies View Related

Forms :: Navigation Form - BrowseTo Command To Open Up A Form In Built-in Subform Module

May 3, 2013

I'm working on the Navigation Form template in Access 2010, which is new to me. It appears that one needs to use the BrowseTo command to open up a form in the built-in subform module. I'm trying to create a couple of buttons where each button opens a form in a different data mode; one in read-only and one in add mode. Here is the syntax I used for read-only:

DoCmd.BrowseTo acBrowseToForm, "frmSales","frmNavigation.NavigationSubform", , ,acFormReadOnly

frmSales is the Sales form I want both of the buttons to open and frmNavigation is the Navigation form. It seems to be ignoring the data mode part at the end however. It only will open in Edit mode. Is there something I'm doing wrong with this command?

View 3 Replies View Related

Open Relevant Form Based On 2 Combo Boxes?

Apr 6, 2006

Hey guys, I'm not sure if this is possible, and it is the most challenging thing that I have tried to implement into my database to date.

What I have is a booking form which allows you to Add Bookings for camera kits.

When a customer comes in and would like to book a kit, the form must be filled in with the relevant details, I have 2 combo boxes on this form.

The first is the Kit selection, there are 5 camera kits.
The second is an option to book the full kit out, or just components.

So here's the tricky part...

When the first combo box selection is made (eg. Kit 3) I need the Kit3 table to be active.

Then, when the user selects "Components" from the second combo box, I need a form to open up based on both of the above.

So a form based on tblKit3 would be opened and the user can manually select the components that they require to be booked out.

Any help at all would be appreciated.

View 1 Replies View Related

Login Username Password Open Form Based On Id

Sep 13, 2006

Hi Freinds,

After viewing all the threads i got some useful information but just wanted some help as i am not a programmer but can understand logics. There are 2 issues i want to resolve

1. First query is i have a login form and in a table there is username password. Now issue is based on the username person should be able to view things. There would be 6 differrent departments. So i would have six users and 1 id only for viewing. These six users should be able to see there own records either assigned to them or create new query and assign to any other 5 users. Now option is either I create six replicated forms and based on the user login i open user form or switch board. Can there be any option where in a table i store the activities they can do and whereever these guys go the code check in table and enable or disable the view of items for other guys. Users would be accessing forms, reports and they would have option of entering cusotmer information and querying and changing information. The user which has option of viewing reports will only have option of seeing some customized reports.

2. Second query is that these six users would be addressing issues to each other regarding cusotmer issue. In this every response of the case should be stored in a table. i.e. like for customer x user1 said abc on 10th then user2 said cbf on 11th. so this would have history of case what was happeining in the matter.

I dont know how to go about this and if there is a easy solution. I dont want to use access security cause then all the six users would have security file.

Would apreciate your help and till now whatever responses i have seen in other forms they were quite helpful and did help me lot in understanding access.

Thanks to all who would be visiting this thread and taking pain in answering the query.

Take care
Ankur

View 3 Replies View Related

Create Checkboxes During Form Open Based On Query

Feb 20, 2005

I am working on a database that tracks products. The products are divided into groups (Bath Salt, Stick Incense, Candle, etc.) and these are store in a table. The products themselves are stored in another table.

When a new scent is created, it can belong to multiple groups ... for instance, Strwberry Vanilla could be a perfume, a bath salt, a candle, stick incense.

When the form is opened, I want to read the contents of the groups table and create a check box for each entry.

I do not really want to use a list/combo box for this task ... would prefer to be able to check in a list of boxes to specify what groups to create entries for when a new product is entered.

Thanks
Phil

View 1 Replies View Related

Open Saved File Based On Form Textboxes

Feb 1, 2006

Hello all,

Do you have a code that would open a saved file based on the contents of 2 textboxes on my form.

The saved files would be in:
C:Documents and Settings100310257Desktop

I have a button on the form, but need a code that would pull up the savedfile using the name in textbox1 and the name in textbox2, like this:
textbox1-textbox2. e.g. textbox1 = Novo Group. textbox2 = AA
There is a saved file in the path above, Novo Group-AA

Thanks for helping!

View 4 Replies View Related

Forms :: Auto Open New Form Based On Expression

May 28, 2013

I have a database (I've attached it for you). I'd like to set it up so that in the "incentive scheme" form when the field [term 1 allow] is changed and is more than 0 then have the form "permissible explanation" appear with that record so the user can add an explanation, they should not be allowed to leave it empty if the [term 1 allow] is still >0 and then save and return to the "incentive scheme" form for further input.

View 11 Replies View Related

Forms :: Open New Form Based On Combo Box Selection

May 26, 2013

I have "donations" form with a cbo called "DonationType".

(frmDonations.DonationType)

General
Employee Match
Employer Match
Angels*
Friends*
Royal Crown*

The last three options need to redirect the user to a different form used for pledged donations.

View 2 Replies View Related







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