Function From FormA Sets Combo Box Value On FormB But Does Not Update SubformB
Feb 21, 2006
I have two forms (FormA, FormB) with combo boxes (cboA, cboB) that control the record being shown in the subforms (SubformA, SubformB). I have written code and attached it to the "AfterUpdate" function on the combo boxes and this works perfectly.
Here's my problem....
I have a button on FormA that, when clicked, opens FormB, assigns the value in cboA to cboB and closes FormA. Unfortunately, I can not figure out how to have SubformB automatically update based on the new value assigned by code to cboB.
I've tried .Requery, "After Update/Change/Dirty/etc." on cboB, "OnOpen" on FormB, and moved the code from cboB "AfterUpdate" to ButtonA "AfterClick" and nothing seems to work.
I need the user to use buttons to navigate through various forms displaying information for the same record. I also need to give the user the option to switch the record using the combo box. Does anyone know how to do this? Is it possible to use code to update the value in a combo box and then have the record in the subform automatically change?
View Replies
ADVERTISEMENT
Apr 17, 2015
I have two forms, both of which have a field called JobID (Form A is the primary Key and Form B is the linked field - Relationship: One to Many).
Form A = FrmJobs
Form B = FrmPurchaseOrders
I have put a command button on Form A. When I click the button I need it to open Form B and then automatically fill the field JobID in Form B with the same value in Form A from which it was opened. I have tried the following:
Private Sub Command214_Click()
Me.Refresh
On Error GoTo Err_Command214_Click
Dim stDocName As String
Dim stLinkCriteria As String
[code]...
The above code works on my old database but not on my new database. I get the following message "Object does not support this property or method".
View 6 Replies
View Related
Nov 18, 2013
I have a data entry formA which has a number of combo boxes and date and time fields. In some cases the user will have to enter data into formB where many of the fields are repeated. I've created a button in formA which opens formB, I'd like this button to autopopulate some fields from formA as well.
These forms feed data to 2 different tables in the database. I've tried using
formB![fieldname]=Me![fieldname]
with no success. I'm using Access 2010
View 2 Replies
View Related
Aug 30, 2013
I have a set of code to keep an audit trail that calls a module:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Call AuditTrail(Me, CurrentCYIDPK)
End Sub
Calls
Code:
Option Compare Database
Const cDQ As String = """"
Sub AuditTrail(frm As Form, recordid As Control)
'Track changes to data.
'recordid identifies the pk field's corresponding
'control in frm, in order to id record.
Dim ctl As Control
Dim varBefore As Variant
[code]....
how to run both of these events on Form_BeforeUpdate.
View 11 Replies
View Related
Feb 12, 2014
i have 2 recordset and i need to compare the two. If a record doesnt existing i need it to be added I have VBA that works but it seems very slow. Is there a better way of doing it
Dim rs As DAO.Recordset
Dim rs2 As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT * FROM ExorData")
Set rs2 = CurrentDb.OpenRecordset("SELECT * FROM MainForm")
Dim TJb_Main, TJb_new
If Not (rs.EOF And rs.BOF) Then
rs.MoveFirst
[Code]..
View 14 Replies
View Related
Nov 11, 2005
Hi All,
I am not sure where to go with this. I have tables Employee, Audio, evaluate.
My main form opens with recordsource = Employee. SubformA is tblAudio linked via empID. I have subformB that is tblEvaluate linked via EmpID.
SubformA is set as contineous form, so there may be 1-?? records per that Employee. I have a command button on subformA next to each record. What I would like to do is: when clicking on the command buton of that record copy some of the fields (of that record only) over to subformB appending or editing tblEvaluate.
I have tried to search through the postings but no luck on anyone discussing what I am trying to do.
Any help would be greatly appreciated....
thanks...Enviva
View 4 Replies
View Related
Apr 22, 2013
I would like my users to be able to view stock items in one (sub)form and when they double click on an item, then certain data is copied to an orders (sub)form.
I have therefore embedded two unbound subforms into a master form.
The master form (Frm Stock) has no fields, but it has 2 subforms.
Frm_Stock_Subform and Frm_OrderDetail_Subform
So I have 2 problems here.
Problem 1:I would like the following code trigger when the user double clicks anywhere on the record that the user wants to order.Thus far, I can only make it fire only when the user doubl;es clicks in a specific field (in this case, the ID field is the trigger)
Problem 2:I cannot activate the Frm_OrderDetail_Subform in order to create the new record. (I have looked at this link - Refer to form and subform
Code:
Private Sub ID_DblClick(Cancel As Integer)
On Error GoTo Err_ID_DblClick
Dim MyOrderID As Variant
Dim MyStockID As Variant
Dim MyAmt As Variant
[code]....
View 3 Replies
View Related
Feb 4, 2008
Hi
Am using a replica set in order to distribute a school reporting system around teaching staff.
Everything works fine apart from one thing. A marking system (basically 1 to 6 list) is stored in a linked table. Before replication this appears in the correct order. Once the database has been replicated however the list is placed in a random order and I cannot rectify this.
With only 6 items this is not much of a problem but I also want to use a much longer list and the same problem appears.
Can anyone explain why this happens and if there is a simple way to get around it?
Am really only an Access novice and I really appreciate any help that you could give me.
Cheers
Mike
View 9 Replies
View Related
Jan 6, 2006
I have a db with two tables linked by a Set_ID field. One table characterizes set information (date, time, location etc) and the other table has records for groups of fish caught in the set. The fish_table has (amongt others) a field for species (text), clip-status (yes/no), coded wire tag status (yes/no), and 'count' (number). The count field is necessary to allow input of groups of fish en-masse, or individually, depending on the amount of accessory information obtained.
Obviously, some sets catch no fish and so no record is entered into the fish table for those sets.
When I design a query, I want to produce a table that sums up the count field for each set, and produces subtotals for each species (and for the 4 variations of the clip/tag status fields).
My efforts so far are only partially succesful in that I can produce the correct subtotals, but only for sets where something was caught. Sets with no corresponding fish_table record are ignored instead of treated as zeroes.
Is it necessary to manually enter a 'zero' count for each species of interest for each set that we do? (Massively time consuming) Or is there some other way to query the db that forces the query to equate no fish record with a zero value?
Any thoughts? I've searched the forum, and googled, but haven't come across anything I could recognise as analogous to my dilema.
View 8 Replies
View Related
Mar 31, 2008
Hi guys,
I have a query that returns a large data set (~100k rows/month).
I am currently inefficiently exporting week-by-week to Excel to carry out some manipulation (mainly a set of "if" statements to calculate differences between records that have the same site id).
Is there a way to write a function in Access to carry out the calculations? I'm not too familiar with Access VBA apart from coding functions for forms etc.
View 12 Replies
View Related
Mar 18, 2013
I have multiple forms that do just about the same thing. I want to clean up the database so I am going to use one form and switches to vary the data or displays if needed. the form can be opened directly, linked to a button and used as a subform. the form is based off one table, but depending on how its opened, the criteria for which record is shown changes. when used in the subform it needs to be based of a field in the main form. When used on the form with the button that opens the form it is using data from the button.
I have 2 different qry's for each problem. I just can't get the form to pick the correct qry va VBA code. I want to have the forms switch to determine which qry to use.
View 4 Replies
View Related
Dec 8, 2012
I have a quotation database running in our company network which we use to send quotes to customers. A quote may have one or more items in it and each item has different prices based on the quantity. Each item will have a record in the database. So, if a quote has five items, there will be five records with same quote number and if 30 items, 30 records with same quote number.
Many times, same enquiries are coming from different sources (customers) asking quotes specially Govt orders. Now we need to take every enquiry as separate and feed separately in the database. Consider the time for a quote which has 30 items in it and each items has 6 level of pricing. When this same enquiry is coming from 12 different customers, it takes a lot of time to feed it in.
Now my question: How can I copy all the records belongs to one "quote no" and add it to the same table with a different quote number and some changes to the other customer related fields? If I can do that, I just need to change the customer address and I am ready with the second, then third and so on. I want to copy all related records, change quote number and related fields and then append to database.
Also I need this when I revise a quote. The system needs to keep the old quote as well as the revised quote for future reference. If I can duplicate it in one command, I just need to do the changes, Revision Number, Revision Date etc. and the revision is ready to go. Now I use update querries to do changes to all related records during revision. Then I will have only the revised quote in my database and when I want to refer the old quote, I have to refer the hard copy.
I know there is a "Duplicate Record" command available in form level (through wizard), but that duplicates only one record, not a selection of records as I need it here. If this can do with macros, fine. I am not an expert in VB, but if I get the code, I will attach it to a command button and use.
View 1 Replies
View Related
Aug 4, 2006
Here's the deal:
I'm an extreme newbie, I do not know access very well, nor do I know VBA, I do know PHP.
I have a for in access that has 2 user input fields, one for prodid one for shipid. I have a combo box that upon entering data into the previous 2 fields, it does a query against an MsSQL database looking for a record that has both. In any case there will only be 2 outcomes, either 1 record, or null. I would like to have that same combo box automatically use the result as it's value so that users don't have to check the box, because they won't, and so that the rest of my VBA will be able to function properly.
Can anyone assist?
Thanks.
View 2 Replies
View Related
Sep 19, 2007
I'm trying to use sum() along with UPDATE as shown below
UPDATE ALLDATA INNER JOIN [Total Data] ON ALLDATA.PanNumber=[Total Data].PanNumber SET ALLDATA.PLAForMonthPrevYear = sum([Total Data].PLAForMonth), ALLDATA.CENVATForMonthPrevYear = sum([Total Data].CENVATForMonth), ALLDATA.PLAUptoMonthPrevYear = sum([Total Data].PLAUptoMonth), ALLDATA.CENVATUptoMonthPrevYear = sum([Total Data].CENVATUptoMonth)
WHERE [Total Data].Month=Forms![FORM REPORT]!Combo3;
IT IS THROWING ERROR
PLS HELP ME
View 1 Replies
View Related
Jan 9, 2012
I have a column with a date in it, and the left four characters are the year. I want to add another column that is just the year. I've tried doing an update query and updating the year column to left(date,4) but it doesn't work. How should I go about updating my year column?
View 3 Replies
View Related
Aug 1, 2013
I have the following tables in my Access database.
A < B < C < D
(The "<" represents a one to many relationship.)A given row in table A can have up to 4 children (stages) in table B (stages 1 to 4).The other one to many relationships do not have any limitations as far as the number of children are concerned.All tables have AutoNumber primary keys.When the user clicks a button in a form, I want to:
Copy all data in the current stage (current row) in table B (corresponding to a given parent row in table A), to the next stage in table B.All data in child tables must be included in the copy process.In other words, for a given row in table A, by use of buttons in the forms for each of the stages 1 3, the user shall be able to do the following:
all data for stage 1 are copied to stage 2 (for user modification), then
all data for stage 2 are copied to stage 3 (for user modification), then
all data for stage 3 are copied to stage 4
Is it possible to do this in Access 2010?
View 4 Replies
View Related
Sep 27, 2007
I am having a bit of a problem with my update query. i have a field that shows a forename. i am importing data from an excel file. The forename populates with forename and middle names and they are seperated by spaces as opposed to commas. I have used the following InStr function in my update query however it works fine when the records forename field has a middle name but it deletes all data in the records forename field if it contains only one name which many do. How can I adjust the function to ignore those records that do not hold more than one name in the forename field. As you can imagine some forename and middle name combinations hold many names.
For instance the filad may have Ivor as a name which I would want to keep But if the Field showed Ivor Bigun then Bigun needs deleting.
Left([Forename],InStr([Forename]," "))
View 2 Replies
View Related
Sep 19, 2005
Good morning,
I am having problems figuring out how to set up my table/query structure for a series of surveys that are based on specific user groups. In a nutshell how do I set up the relationships for the Questions, Employees, and Answers if I have the following tables (simplified):
tblQuestions
--------------------
QuestionID (P)
UserGroupID
Question
tblEmployees
--------------------
EmployeeID (P)
Name
UserGroupID
tblAnswers
--------------------
AnswerID (P)
QuestionID
EmployeeID
Answer
The functionality requirements are:
1. Create a set of questions for two or more user groups (each set contain different questions).
2. Assign Employees to a specific user group.
3. Employees are able to enter the DB to answer the questions within their user group.
What should happen is the employee accesses their set of usergroup questions and enter the corresponding answers. Each time I try to set up the relationships however, the answer field ends up being uneditable.
Any help you can give would save what little hair I have left.
Thanks!
Bob
View 2 Replies
View Related
Aug 8, 2014
I'm trying to set up a way to import and combine excel files that contain multiple data sets. So for example, each excel file has a summary heading which consists of the first 3 rows.
Each data set thereafter consists of approximately 50-60 rows of data that I would like. There are approximately 1400 groups of data. Each group has a label which includes the state and the store number. I would like to automate a way to copy the state and store number information down each data set as well.
I have approximately 200 excel files that I want to load into access and have it format it so it basically will end up 1 big file with State, Store Number, relevant information from the data set. I've seen a module do this before, can't remember how to do it.
View 4 Replies
View Related
Jun 18, 2015
I want to be able to make row searches for multiple sets of characters at the same time.The default setting cancels a row if I have inputed a set that is not on that row.Something that could be used in a store or by a lawyer looking for specifics.So these are what I am looking for:
Primary
1.) I want any row with any of the words I type to show on the results.
2.) I want the rows with the most matches to show up first.
Secondary
1.) Recognize sets of characters that are close to what I type to make up for spelling errors and typos, prioritize those that are closest.
2.) To be able to choose the rows I want and add them to another list quickly where the summing cost will be calculated in the last raw (multiplying the price of a row by how many the customer wants.)
View 6 Replies
View Related
Aug 15, 2006
I am using MSAccess 2003.
Have a Combo Box in a form, for which when the selection from the Combo Box is made, I would like to only save the string - from after the 7th character - saved within the field.
I understand there is a Mid() function (from reading other postings) and this sounds like what I would need to do correct? But where do you place the code? Is this considered a "format" function?
My Combo Box and Control Source are each entitled "Location".
Thank you for your guidance.
View 1 Replies
View Related
Dec 31, 2007
Hi ALL,
I have 2 tables, trying to update one table filed by using max(onefiled) from other table.
my qyery is as follows:
my tables are tblSubFlowForecast and tblPickCalendar
I have to update one field in tblSubFlowForecast by taking max(onefiled) from tblPickCalendar.
UPDATE tblSubFlowForecast INNER JOIN tblPickCalendar ON tblSubFlowForecast.Delivery=tblPickCalendar.Delive ry SET tblSubFlowForecast.[Latest Replen Date] = ( SELECT max(Pick) FROM tblPickCalendar WHERE Type="Replen");
I am getting error saying that "Operation must be an updateable query" :(
I have also tried in other way:
UPDATE tblSubFlowForecast SET [Latest Replen Date] = (SELECT max(Pick) FROM tblPickCalendar WHERE tblSubFlowForecast.Delivery=tblPickCalendar.Delive ry AND tblPickCalendar.Type="Replen" ) FROM
tblSubFlowForecast,tblPickCalendar
This is giving me syntax error (missing operator) :(
Can any body tell me why it is giving error?
Thanks in advance
View 3 Replies
View Related
Oct 31, 2004
I'm having problems with an assignment in an online course I am taking.
The assignment is to create one Update Query to find & remove typos in a field. Specifically, the typos are multiple f's & g's embedded in a field.
I created an Update Query that finds the typos & removes just the f's. I'm having trouble with the syntax to also remove the g's.
This is what I have so far that works great.
Update: Replace([Field2],"fff","")
Criteria: Like “*fff*”
or: Like “*ggg*”
The Query finds the records that contain both the "fff" & the "ggg" typos but I'm having trouble with Syntax for removing both.
Does anyone know what I have to change in the "Update:" line to include removing the g's?
I know I could easily create 2 Querys to remove the f's then the g's but the assignment requires only 1 Query to remove both.
Thanks,
Yaani-Mai
View 5 Replies
View Related
Jun 16, 2013
I have this code below that is working however the calculation are updating on my form late.
Basically, I have some calculation that are performed on a "After Update" event on some controls on my form. I wanted it to do the calculation after I update the control on the form.
The code is in a module and I just call the function after update on the control But the form is not updating when I change the value in a field. I have to change the field again for it to update.
Control
Code:
Call GeraAuditCalc
DoCmd.RefreshRecord
Function
Code:
Function GeraAuditCalc()
Dim fHrs As Double
Dim Ttl As Double
Dim Ttl1 As Double
Dim Ttl2 As Double
[Code] ....
View 4 Replies
View Related
Jun 10, 2015
I'm trying to update some field value depending two string field using a function with if and case, function below:
Code:
Private Function checkDATI(tipotransazione As String, tipovendita As String) As String
Dim r As String
r = ""
If tipotransazione = "VENDITA" Then
Select Case tipovendita
[code]...
And then when I call this function in a command button event as:
Code:
MsgBox (checkDATI(Me.CausaleMov, Me.txt_tipomov))
It's not update those field.
View 6 Replies
View Related
Nov 21, 2013
Would I use an update query or function to complete my task?
Task: Automatically update [Status] based on DateDiff calculation of [RequestDate] and [DueDate]
Issue: [Status] can be one of 6 values, the user can manually select Review or Completed.
[Status] values: Review; Completed; Due in 24; Due in 24-48; Beyond 48; Over Due
Query: Below is the query I just started to ignore the calculation if either Review or Completed exist.
Expr1: IIf([Status]="Review",[Status],IIf([Status]="Completed",[Status],DateDiff('d',[RequestDate],[DueDate])))If the value from above DateDiff equals to the below, I want to update the [Status] field to the [Status] value.
Due in 24 = (0-1)
Due in 24-48 = (2-3)
Beyond 48 = (greater than or equal to 4)
Over Due= (-1)
View 14 Replies
View Related