I need to loop through all 25 to check that the ProdQty for each is correct, and if any of them are incorrect, I'd like to set the BackColor to Red and the ForeColor to White for that particular set of controls. Rather than coding all 25 checks, I'd like to use variables to loop through the 25 sets
I understand how to create an incrementing Integer variable, but what is the correct syntax for combining that Integer variable with the String variables in order to perform the Back/Fore color commands?
i have created a module under module section of my DB My Report Name : "PURCH VB Query"
the code is as follows : (what is want tell you later..)
Code:
Sub Erlick() DoCmd.SelectObject acReport, "PURCH VB Query", True '"PURCH VB Query", acViewPreview, "PURCH VB Query" For i = 1 To 3 DoCmd.PrintOut acPrintAll, , , , i Next i
'This is for creating Seperate Text Per Copy in RptHeader Preview End Sub
i've placed a TextBox in my report named Text25 to the value : =+1 properties-->data-->running sum--> Set to OVer all
i've also set a textbox in my report named CpyWord to the value : =IIf([Text25]=1,"Original Buyer Copy", IIf([Text25]=2,"Duplicate File copy",))
Now what is want is Three Copies of Report with Two copies marked seperately as per above IIF statement
As i want Three Copies with each Rpt-header as Different Text
Possible solutions (ba donna no a script) How do i refer to Report's control after Docmd.SelectObj.... if any facility then i can do easily thru the dazzling for next loop How do i increase Report's control Text25's value, if three copies r there I know there are many events in Report
I've stucked over this point. My all App in db is ready
I have a main report which has a subreport. On the main report I have txt fields that I want to change their background colors based off values in fields on the sub report.
I'm working on creating a small database for the company I work at and just can't figure out the syntax to make this work.
If I create a query that looks for clients Like '*Smith*' , it returns records where the client is John Smith, Smith and Company, Edward Smith & Jones, LLC and that part works great! I did this by typing: Like '*Smith*' in the criteria field for Client in the design view of the query. (Also seems to work whether I use single or double quotes - not sure about the implications of that).
Now, I want to replace the word Smith with whatever a user enters into a text box, I can't get the syntax right! In the design view of the query, I've tried things such as: Like '*forms![Search by Client]![Text0]*' with no luck. Any ideas? Maybe I'm missing some brackets or parenthesis?
Well I got a problem and guessing this is possible to do like this but well after few hours and staying at the same point maybe some help can be greet
I have a database witch I have 2 important field and a command for this. A field called ID with a number and another called GenerationID who contain number between 1 to 12 depending of which generation is. I got this Generation ID from a subform. What I want is this:
Depending of the number in generationID field show a different button like ID3 with generationID = 3 or ID2 if generationID = 2 etc until 12 and then other command buttn is not visible.
I don t know how to put the code but the code probably look at this:
If generationID = 3 Then ID1.Visible = False ID2.Visible = False ID3.Visible = True Else If generationID = 2 Then ID1.Visible = False ID2.Visible = True Id3.Visible = False End If End If
in the criteria box, but every time the query runs i get a parameter box "forms!training courses!course_dates subform control!course_dates subform!course date" asking for the info.
Seriously I am totally stuck on this and i think all i need is one perfect example... please help!!!
I'm sure this is simple, but I can't find it anywhere...
How do I refer to an instance of a form using its key value?
For example, I have a collection 'colForms' and two forms in that collection with the keys 'Key1' and 'Key2'. How do I refer to the instance that has Key1 in code (for exampe, to close or requery the Key1 instance of the form from another form)?
I have a table with 6 columns (Field1, Field2...) and a primary key called ID (1,2,3,....).In the first column (Field1) I want to retrieve the value from the 6th one (Field6) but from the above row. Something like this:
I've done some searching on this question and it seem everyone is pointing to the DateAdd function, so here is my current problem.
I have a date/time field called SponsorshipContractDate. When a contract is signed the date is entered. I need the system to calulate the renewal date for the contract which is alway 1 year ahead.
The DateAdd function works only if I hard code at date into it e.g.
DateAdd ("yyyy", 1, "01-Jan-08")
But as contracts are signed throughout the year this just doesn't work so I tried this:
DateAdd ("yyyy", 1, "SponsorshipContractDate") but the table won't save and this is abviously not right. In my head it makes sense but I don't understand how to get the formula to look at another field during it's calculations
Access 2003. I was just wondering if there was any way to refer to a calculated field in the same query. For example if the first calculated field was - Total: ([Quantity])*([Price]), could you add another calculated field - Inc Tax: ([Total])*1.175. At present I am having to type the whole formula in the calculated field again which seems to work for some queries, but not for others, no matter how I fiddle about with the syntax. The other way is to create another query and refer to my previous query. Both these methods seem extremely cumbersome and I was wondering if I have missed something with referring to a prior calculated field. The query above is just an example, my query formulas are actually fairly long and for editing purposes it can be difficult to correct them.
Hello - I have a form with a txtbox that shows a date. I need the querry to refer to that date as selection criteria. I have the following in the criteria of the query: =[forms]![frmUpdatePayments]![txtDate]. I know the problem is I need # at the beginning and at the end of the date, but how do I do that?
I have a form named frmtestpkg which has a subform named pkgsubform. The control the subform is in is called pkgsubform1. I have written a macro which works very nicely to hide or show the field [Days2process] if I attach it to "on current" on pkgsubform and open pkgsubform as a form. If I try to open pkgsubform as a subform I get a message stating "The object you referenced in the Visual Basic procedure as an ole object isn't an ole object."
How do I change my macro to refer to the form and controls as a subform?
my Macro looks like this:
condition: [Forms]![Pkgsubform].[CrPkgStatus]<>"Accepted" Action: SetValue Item: [Forms]![pkgsubform]![Days2Process].[visible] Expression: No
Still beating my head on the wall. I'm sure it is simple but I NEED guidance.
I've made a macro to show a date field when the "Yes" option button is selected and hide it when the "No" option button is selected. I first created it for the form to act on its own --> and it works. Now I want to use that form as a subform in the form [frmTestPkg]. I am having problems figuring out how to reference it properly as a subform.
Here's my macro that works when I attach it directly to my form:
Condition:[Forms]![frmsubcruiseplan]![CrPlRecvdNo].[OnGotFocus] Action: SetValue Item: [Forms]![frmsubcruiseplan]![CrPlSubmDate].[Visible] Expression:No Location: "On Got Focus" Event for the option button "No"
Condition:[Forms]![frmsubcruiseplan]![CrPlRecvdNo].[OnGotFocus] Action: SetValue Item: [Forms]![frmsubcruiseplan]![CrPlSubmDate].[Visible] Expression:Yes Location: "On Got Focus" Event for the option button "yes"
I have followed the pattern provided previously of
Forms![main form name]![subform control name].Form![control name]
but cannot get it to work -- obviously messing up somehow.
The reference I tried in the condition looks like this
--> and with or without the setvalue information included I get a "The object you referred to as an OLE object isn't an OLE object" error.
Perhaps I am not identifying the subform control name properly? Or maybe I should be referring to the "Cruise Plan Recvd Option" instead of the individual control boxes (but it worked as a form)? Please spell it out for an idiot, what this is supposed to look like. Many thanks!
I have a report with several subreports. I need to total the subreports onto the main report. How do I refer to the control on the subreport?I know that with a form / subform I would use: Me!Subform1.Form!Controlname.But simply replacing 'Form' with 'Report' doesn't seem to work.
know if there is a way to use a string concatenation to refer to a control name. eg. Referring to Control1, Control2, Control3, Control4, etc using something like Me.["Control" & "1"], Me.["Control" & "2"], etc
I have a main form with a subform. On a subform I created a combobox which I want to populate with ClassIDs that match the main forms Individual. I know the criteria in VBA for the above would look something like this:
"SELECT tblClassesAttended.ClassID FROM tblClassesAttended WHERE blClassesAttended.IndividualID=" & Me.Parent!IndividualID
but when I type such statement in the row source of the control it does not work. What is the correct way of refering to the parent form when typing the SQL in the row source? BTW. I cannot use the main form's name
On it, there is a subform called 'patient' - this has a number of subforms in the detail section (Linked on a one-to-one key).
When the patient form loads, I hide the detail section until a user either
A. Finds an existing client record or B. Clicks the 'ADD NEW' button
The ADD NEW button opens a separate (pop up) form where the primary patient information is gathered. When the user clicks "Save" on the pop up, my VBA script ...
A. Creates all the one-to-one relationships that are required. B. Updates the 'Find Patient' field to the newly created patient number C. Finds the new record D. Un-hides the detail section (This is what I cant get to work)
The rationale for hiding the detail section in the first place? The answer is twofold.
1. If the user simply creates an new patient, the three actions (A, B C above) don't always run/display the data properly. (Im not sure why? ) The pop up form seems to be a good working solution for me. 2. My users have a tendency to change data on the default patient. I have tried going to new record, but then they add new (often duplicate) patient records.
I'm trying to refer to previous record in a query and i'm stuck as i do not know how to do it.
Here is my query:
Code: SELECT [Prod2Buy].[Product Code], IIF([Missing] IS NULL,0,[Prod2Buy].[Quantity To Order]-[To Order]) AS [Rest To Order], s.s_manu_code AS [Manufacturer Code], s.prod_cost AS [Price Code],
[Code] ....
In fact the line: IIF([Missing] IS NULL,0,[Prod2Buy].[Quantity To Order]-[To Order]) AS [Rest To Order] should refer to previous record.
I have a SQL query to gather data from a number of tables (balances, accounts, currencies)
Quote:
SELECT [tblBalances].[BalanceDate], [tblAccounts].[AccountNumber], [tblCurrencies].[Ccy], [tblBalances].[Amount], ([tblBalances].[Amount]*[tblRates].[FXRate]) AS AmountUSD FROM (([tblBalances] INNER JOIN [tblAccounts] ON [tblBalances].[AccountID]=[tblAccounts].[AccountID]) INNER JOIN [tblCurrencies] ON [tblBalances].[CcyID]=[tblCurrencies].[CcyID]) INNER JOIN [tblRates] ON ([tblBalances].[BalanceDate]=[tblRates].[RateDate]) AND ([tblBalances].[CcyID]=[tblRates].[CcyID]) WHERE BalanceDate = #12/10/2013#
How do I add 'AmountUSD' to the WHERE clause (such that I can only return records above or below a certain value, for example)
Along the lines of :
Quote:
WHERE BalanceDate = #12/10/2013# AND AmountUSD>1000
I know it's an issue with referring to aggregated functions in the WHERE clause and you're supposed to use HAVING instead
I have a main form with a continuous sub-form. On the main form I have a series of text boxes that I want to use as a makeshift status bar. The text boxes would be filled in if a value was entered into certain records on my sub-form.The problem I have is since the sub-form is continuous, how would I refer to the specific record on the sub-form that I want to check for a value?