How To Use Same Form By Changing Record Source?

Feb 8, 2005

Hi all,

I have Form F_CashSalesHead with a subform F_CashSalesInvFoot with one-2-many relationship on their tables. Subform contains a checkbox field that I use to lock the record set (On a command button click it runs one update query to add value 1 to each checkbox to make Enable=False all the records of current invoice on the form).

One-2-many relation ship is made on InvNum field in both tables.

When I open F_CashSalesHead form, bcz of some code line I wrote on On Load event of F_CashSalesHead , at the beginning it give massage how many invoices are pending to lock and would you like to see. If click Yes to see list, it opens a small form that called F_Count_Unlocked_Invoices showing invoice numbers and unmarked checkbox which is pending to lock. This small form is based on following query,

SELECT DISTINCTROW T_CashSalesInvFoot.InvNum, T_CashSalesInvFoot.CashSalesCustomerName, Sum(T_CashSalesInvFoot.Lock_Cash_Inv) AS [Sum Of Lock_Cash_Inv]
FROM T_CashSalesInvFoot
GROUP BY T_CashSalesInvFoot.InvNum, T_CashSalesInvFoot.CashSalesCustomerName
HAVING (((Sum(T_CashSalesInvFoot.Lock_Cash_Inv))=0));

This works fine.

What I am looking for is, I want to use the same F_Count_Unlocked_Invoices form for Credit Sales invoice also with the same trick. Because I dont want to create another same form and write code that help to increase size of db.

Can it be done just by changing record source of form F_Count_Unlocked_Invoices? Or what is the way to do it?

With kind regards,
Ashfaque

View Replies


ADVERTISEMENT

Modules & VBA :: Changing Record Source On A Form - 2 Different Outcomes Using Same Bit Of Code?

Apr 28, 2015

I'm changing a record source on a form when the user clicks a "save" button.

I'm doing this to store a value from the current form in a table that is not part of the default form query.

This works fine.

I have a separate button on my form called "Home", when the user clicks this button it requerys the current form which triggers the before update event to run, this in turn brings up a message box which asks the user if they want to save or not. If they click yes then it runs the SaveButton click() code.

For some reason when the user presses the save button and then exits, everything works but if a user presses the “home” button which triggers the save button then it brings up the “2107 The Value you entered doesn’t meet the validation rule defined for the field or control.” Runtime error and stops on the change recordsource command.

Why triggering the same code directly from a button or indirectly from a before update event has two different outcomes.

View 4 Replies View Related

Changing Record Source On Subform

Mar 25, 2005

Hello, I have a form with a subform. I want to change the record source on the subform during an OnClick event. I am not sure what I'm doing wrong, but I get a "object does not support this method" error. Can anyone help? Thanks in advance.

View 1 Replies View Related

Forms :: Changing The Record Source From Within A Subform

Nov 2, 2014

Can I change the Records Source of a subform from within that subform and do a requery to have a different set of records displayed'

I want to be able to refine the records displayed in the subform

View 8 Replies View Related

Forms :: Changing Record Source Of Query Profile

Nov 4, 2013

My form has a Record Source of qry_Profile, it is a query that shows the user the records of the dogs that they currently own. I want to put a button in the form footer to allow the user to show the records of all the dogs that they have ever owned.

So my question is how do I change the record source with vb.

View 1 Replies View Related

Changing Record Source - No Functions / Events Work

Oct 24, 2012

I have created a system consisting of a data entry form etc. It was originally connected to one record source exported from a sharepoint site.I had to add a field to the sharepoint site and so i created this additional field and re-exported the data and changed the forms record source and all occurences in the code of previous to new record source.

However, this change of record source produces the following error on every single event.The expression On Load you entered as the event property setting produced the following error: member already exists in an object from which this object module derives.

I tried to break the code as soon as it hits the load function to track the error - but it doesn't even run this function so the code is not executing at all.When i connect back to the old record source it works fine.

View 1 Replies View Related

Changing "record Source" In SubReports With VBA

Mar 28, 2005

I have an application with a form where 20 subforms are used to add data to the same table. The 20 subforms are used to divide the data being added into categories ( think of a grocery store with categories of "Meat", "cereal', vegitables etc)
I use the same subform (with different names) and change the record source on the formOpen event to change the subforms properties. A portion of the code is shown below.

tempRecordSource = "SELECT [tSkills Assessment].Skill, [tSkills Assessment].Scale, [tSkills Assessment].Comments, [tSkills Assessment].AreaOfFocus, [tSkills Assessment].SubSectionTitle " & _
"From [tSkills Assessment] WHERE (([tSkills Assessment].SubSectionTitle)=" & Chr(34) & tempSubSectionTitle & Chr(34) & " and ([tSkills Assessment].SkillsAssessmentID)=" & [SkillsAssessmentID] & ") ORDER BY [skillOrder];"
Me(tempSubFormName).Form.RecordSource = tempRecordSource

I use an array to feed the code (which is in a loop) the variables needed to assign the correct properties to all the subforms.

And it works great. Yes I know I could have created 20 different subforms, but in an attempt to keep my application simple I am trying to have less objects.

The problem is in my output (the Report).

When I try to do the same thing on subreports it doesn't work. I figured the logic should be the same but the code that corresponds to the form code "Me(tempSubFormName).Form.RecordSource = ..." doesn't work. Either the logic is wrong or I am not using the correct event???

I have tried every combination I could find on the internet and $300 worth of Access manuals but no luck. Any ideas?????

View 12 Replies View Related

Changing The Source Of A Textbox

Jul 14, 2006

A simple question that would probably take me hours to figure out by myself: When I want to change the source of a listbox, fx. when a button is clicked, i use the command 'rowsource ='. But what command do i use to change the source of a textbox...??

Thank you in advance :-)

// JR

View 5 Replies View Related

MDB....underlying Changing Data Source

Dec 1, 2006

Hi!

I have an MDB file that points to a postgres database. What I'm trying to do is to redirect it to another datasource. The database is exactly the same, but I just need to point it to a different location. I tried doing this with linked table manager by refreshing the table and enabling the "always prompt for new location". I was able to point to my new location but what happened was my MDB became readonly, I am unable to edit anything after I changed the datasource.

View 2 Replies View Related

Forms :: Changing Source Of Combobox

Jan 26, 2014

I have a form (named Example) to create reports by selecting fields from tables or queries. there is a option box (name is KynkSec) with two options (Table, Query) and a combobox named as KynkTurSec.I want to change the data source of combobox either table or query. By afterupdate, that combobox is requering the listbox "ListKynkAlan" and I can see fields of selected table or query. (That is my dream))Unfortunately I can not do that. Combobox is showing only tables or both of tables and queries. But not only query.

Here is str source of my combobox:

SELECT MsysObjects.Name, MsysObjects.Type FROM MsysObjects WHERE (((MsysObjects.Type)=1) AND ((Left$([Name],1))<>"~") AND ((Left$([Name],4))<>"Msys")) OR (((MsysObjects.Type)=5) AND ((Left$([Name],1))<>"~") AND ((Left$([Name],4))<>"Msys")) ORDER BY MsysObjects.Name; That is showing both of tables and queries.

And I wrote a code for KynkSec option box;

Private Sub KynkSec_AfterUpdate()
' Populate rowsource of KynkTurSec
Dim strSQL As String
On Error GoTo HandleErr
Select Case KynkTurSec

Case 1

strSQL = "SELECT MsysObjects.Name FROM MsysObjects" _
& WHERE(((Left$([Name], 1)) <> "~") And ((MsysObjects.Type) = 1) And ((Left$([Name], 4)) <> "Msys"))
Order BY(MsysObjects.Name)

Case 2

strSQL = "SELECT MsysObjects.Name FROM MsysObjects" _
& WHERE(((Left$([Name], 1)) <> "~") And ((MsysObjects.Type) = 5) And ((Left$([Name], 4)) <> "Msys"))
Order BY(MsysObjects.Name)
Case Else
End Select

[code]...

But this code is not working and giving a warning messsage "Sub or function is not defined"..So How can I change the source of combobox, either table or Query?

View 3 Replies View Related

Changing ODBC Data Source?

Jul 23, 2014

I am having difficulty with my Access database, when I run a particular query. The query is linked to a table in SQL Server, but I keep getting a "ODBC -Call Failed" error message. After some research I understand I might need to change the ODBC Data Source, but this is something I have never done and am unsure of how to do it so my query will work!

View 2 Replies View Related

Change The Sub Forms Record Source

Nov 16, 2005

I have a main form that has 10 sub forms Each sub forms record source is link to a different Query.

It takes more then a minute to open the form, (because its running the query for all sub forms). So I changed the sub forms source to SELECT * FROM tblTest WHERE false;

I also changed the main form. When the button on the main form is clicked, its adding the following:

Me.SubMySub.Form.RecordSource = "select * from qMyQuery"
Me. SubMySub.Form.Requery

However, after I close the main form, the sub forms record source stays linked to
SELECT * FROM qMyQuery;

And will take the same long time again to open the main form.

Does anyone have any solution?

View 7 Replies View Related

Cascading Form Record Source

May 17, 2005

Heya. I hate posting yet another cascading query but I just poured through the first 40 bits and couldn't find something similar.

Basically, I seem to have an errored idea in how to effectively used cascading boxes on a larger form-wide scale.

Basically I have a form with an unbound combobox in the form header: cboSchool

The detail section should only have two fields, StudentID (txtStudentID) and a boolean (bolOT) both of which exist in a specific table source (tblStudents). StudentID is a locked field.

What I would like to do is only have the StudentID's available that are valid for the school. I attempted using a query in the record source that would reference cboSchool but I keep ending up with blank forms. (There's a string of queries that link the schools found in cboSchools to StudentID)

Any ideas?
~Chad

View 5 Replies View Related

Record Source Problem On Form

Jan 10, 2006

Hello,
I'm having a strange problem and was wondering if anyone can help me out. I have a form that is for inputting and modifying data in one table. It used to work when you opened the form you would see x amount of records. Now it's opening to 1 blank record. If you hit filter it fliters like 1700 records and then when you unclick it, you get the entire 10000 records. I thought it had something to do with the Record Source in the properties but when I fixed that it still didn't work. Any ideas?
Thank you!

View 2 Replies View Related

Get The Recordset From The Record Source Of A Form

Aug 31, 2004

I have 2 forms. On form1, the record source is a query. From form2, I need to iterate through the recordset from form1 and perform some action. How do I access the recordset from form1?

Thanks in Advance,
-jnoody

View 1 Replies View Related

Forms :: Record Source Set From Another Form

Jun 19, 2014

This code loads a new subform in the frame. It then scopies a value to an input field but then i need to set the record source and display the data. This latest pasrt does not work.I've been trying for some time now by changing the part before recordsource but no luck.

Code:
gekozenwo = Me.Keuzelijst0
Forms!switchboard.subfrmWindow.SourceObject = "frmInformation"
Dim frm As Form
Set frm = Forms!switchboard.subfrmWindow.Form
frm.DataEntry = True
Forms!switchboard.subfrmWindow.Form!Tekst33 = gekozenwo
MsgBox gekozenwo

frm.RecordSource = "SELECT * , [orders_maint_detail]![woisnr] & ' / ' & [orders_maint_detail]![Ordernummer] AS Expr1 " _
& "FROM orders_maint_detail " _
& "WHERE (((orders_maint_detail.woisnr)='" & gekozenwo & "'));"
Me.Requery
wonr = gekozenwo

View 2 Replies View Related

Remove Record Source/Control Source

Sep 19, 2005

I have an unbound form with three tabs. On each tab there is a sub form. Each tab is a search form and each sub is a results returned. I have made everything unbound and set the sub form recordsource and its controls control souce on afterupdate of the main form search criteria. Works fine except for after some use the db decides the sub forms are not unbound and sets the record source and control sources.

I'm trying to do a

Me.PollingPlacesResults.Form.RecordSource = ""
Me!PollingPlacesResults!PollID.ControlSource = ""


but this does not seem to work in actualy removeing the record source and control source.

View 14 Replies View Related

Changing Data Source (table) For A Query

Jul 18, 2006

Hi,

I have two Tables TA and TB. I have a set of queries based on TA. I want to substitute TB for TA (i.e. TB will stand in place of TA). I want the old TA queries remain unchanged but now be based on TB.

If I delete TA and then rename TB into TA, I will lose the queries. Therefore I want to 'point' the queries (in the most efficient way) to TB instead of to TA.

Then I can delete TA. Then I can rename TB into TA and the queries will follow along, I expect.

I have been trying in vain to find a way of pointing the queries to TA instead of TB? How do I do it?

I have done it with Forms (Design Views, Properties), where I can select a datasource. But where is the corresponding thing enabling me to select a datasource for Queries?

Thanks.

Adrian

View 13 Replies View Related

Changing Source Database String On Append.

Feb 12, 2007

Hello,

I think i've done this before but I can't seem to remember the process so any help would be great. What im trying to accomplish here is I have a database that will be updated(new data appened) to on a daily basis from many other databases, but the data that is to be appened can come from various destination drives ie (C: drive, D:drive, CD, Thumbdrive, etc). I set up a dialog box that prompts the user to select the source database, but im not sure how I can store that source destination string and update my append query with that source database string. I believe there is a way to do this. Am I making any sense? Any help would be so great. Thank you in advance.

-James

View 1 Replies View Related

Changing Table Source In Query Using Vb Instead Of Manually Doing It.

Aug 17, 2004

I have a Query called Median and all it does is pulls all the fields and all the records from 1 table. Since the Query is connected to a lot of other queries, and the table it's connected to changes twice a month, I was wondering if there was a way to set this up in a form maybe using vb, so a user could maybe Click a new table from a combo box list of current tables in the database, then click a button that says "Change", and it change all the fields to the new table and removes the old table from the query.

Or what might be better is: Already on the form, i have part of the name of the new table already entered by the user (it bases the new name of the new table off this text box). So, what I can use is the Text in that box and an & " the rest of the tablename", and automatically change the table in the Median Query based on that criteria. If that is too complicated, then a combo box will be sufficient.

Another way i guess, would be to setup a hidden field that takes whatever's in my text box (which is a date) and adds " the rest of the tablename", then I could base the replacement table of the Median on that one text box.

Anyway, is there a way to do this?

View 6 Replies View Related

Dynamic Query And Record Source In A Form

Feb 23, 2005

I have Form A that has a combo box and a "Submit" button. When the user clicks on the Submit button it needs to open Form B. Recordsource of this Form B is "Query B"

Item selected on the combo box becomes the criteria for "Query B and Form B needs to be opened based on that criteria.

What is the easiest and fastest way (no dlookups please!) to do this?

If an illustration is possible through an example that will be wonderful.

Thanks in Advance.

View 1 Replies View Related

Record Source For One Form Multiple Tables

Mar 26, 2005

I am making a master form for three tables which ultimately form a hierarchy. I am getting all the fields from each table onto one form. By default the record source would be made up of an INNER JOIN such as below

SELECT PERSON.first_name, PERSON.country, PERSON.last_name, PERSON.street, PERSON.area, PERSON.city, PERSON.telephone, CONTRIBUTOR.registration_date, CONTRIBUTOR.fav_category, MUJAHED.profession FROM (PERSON INNER JOIN CONTRIBUTOR ON PERSON.id=CONTRIBUTOR.id) INNER JOIN MUJAHED ON CONTRIBUTOR.id=MUJAHED.id;

I'm trying to change the record source to match using the where clause instead. However the following allows me to view but not add a new record

SELECT PERSON.first_name, PERSON.country, PERSON.last_name, PERSON.street, PERSON.area, PERSON.city, PERSON.telephone, CONTRIBUTOR.registration_date, CONTRIBUTOR.fav_category, MUJAHED.profession
FROM PERSON, CONTRIBUTOR, MUJAHED
WHERE (PERSON.id = CONTRIBUTOR.id) AND (CONTRIBUTOR.id = MUJAHED.id);

A tip or guideline on how I can correct this will be appreciated.

Regards

View 1 Replies View Related

Data Entered In Form To Record Source

Aug 26, 2005

I have a form where users enter data in various ways - combo boxes with drop down selections and text boxes where users manually enter some data. I also have several text boxes that return "answers" based on calculations from user entries mentioned above. The form is bound to a table where all the entered data is stored. I'm having trouble saving the calculated information to the bound table. It's easy in all the non-calced boxes, I just put the column name of the bound table in the control source, but in the calculated fields, I already have the formula in the control source. How can I identify the proper column to save the data in this case.

Thanks!

View 5 Replies View Related

How To Change The Record Source Of A Report From A Form

Sep 22, 2005

I'm looking to change the record source of a report and then print the report depending on what button the user clicks on.

Is there some way to do this?

View 8 Replies View Related

Form - Record Source - Select A Table

Nov 13, 2013

Form - record source - select a table that when the user enter a value in the field of the form it gets place into the designated table (select a table). my problem is that I have two fields in the form, one field from the data entry is suppose to go to the train table,and another field the data entry is suppose to go to the station table. if I have the form's record source have a designated table for the data entry.It doesn't have two tables for the data entry.

View 13 Replies View Related

Changing Subform Source Object Causing Problems

Aug 30, 2005

I'm trying to change a database that consists of a sequence of subforms held individually within different tabs on a subform. There seems to be a bit too much going on, so I've decided to leave the subforms unbound, and set them when the appropriate tab is selected, and unset them when the tab is changed. For most of the subforms, this works fine...

However! There's always an exception!!!

On one of them, when I set the sourceobject, it automatically populates the linkchildfields and linkmasterfields properties with an inexplicably crazy number of fields, most of which aren't even on the forms in question. I've tried to get around this by setting linkchildfields and linkmasterfields after changing the sourceobject. This does not work!

The first thing that happens is it returns error 2335 (relating to an imbalance between the number of fields) when I set linkchildfields. I try to get around this by trapping and resuming to the next step so it sets linkmasterfields and restores the balance, but, despite the fact that the linkchildfields and linkmasterfields are showing the correct fields, the form acts as if it has been bound with the screwy list of fields, and starts asking for fieldnames which are on neither form as parameters. When I hit cancel the subform control is empty.

I'm at a loss as to what the problem is or how I should sort it out! Any suggestions gratefully received.

View 2 Replies View Related







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