Refer To A Table Value Though Form
Mar 10, 2005How can i refered to a table value through a form?
Thank you!
How can i refered to a table value through a form?
Thank you!
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:
Field1 (ID2) = Field6 (ID1)
Field1 (ID3) = Field6 (ID2)
How can I translate this into a formula?
Hi All!
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
or if you have a better way all is welcome.
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)?
Thanks in advance,
David
dminstance
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?
View 1 Replies View RelatedAn instance of a form can be opened with:
Dim frm As Form
Set frm = New Form_formname
How can this be done using a variable as the formname?
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?
View 6 Replies View RelatedI have Main Form is named MainFrm and it has
two Sub Forms :
- OrdersSubFrm
- DetSubFrm
I want :
if OrdersSubFrm is not contains any records DetSubFrm is not enabled
In my DB i would like to make a form that displays different calculated values based on other forms and queries like income running cost etc., but i do not know how to refer in an unbound control to value of a control in another form. I get always #names? error. However it worked when loaded that form i refered to. Is there a way to do it without loading the refered form?
View 3 Replies View RelatedThere is a command button on my form that calls a filtered query. I'm filtering the query based on a combo box within the form using
[Forms]![frmAssignDwgs]![Combo15]
It works beautifully until I put the form as a subform in the Navigation Form I'm using. When I execute it from within the Navigation form, it errors out looking for [Forms]![frmAssignDwgs]![Combo15].
Is there another syntax I can use so this will still work from within the Navigation Form? Or another way to approach this functionality?
frmNavigation is the main navigation form
frmAssignDwgToPkgs is the subform that holds Combo15
I found another thread (which I can't link to since I'm new) and tried various arrangements of the following to no avail.
[Forms]![frmNavigation]![NavigationSubform] .[Forms]![frmAssignDwgToPkgs]![Combo15]
I have a Main form with two subforms Sub1 and Sub2.
I want to set the RecordSource of Sub2 from the OnGotfocus event on Control1 on Sub1.
My code is:
Dim intCtrl as integer
Dim strSQL as string
intCtrl = Me.Control1
strSQL = "Select * from MyTable where Id = " & intCtrl
Forms!Main!Form!Sub2.RecordSource = strSQL
Forms!Main!Form!Sub2.RecordSource.ReQuery
When Control1 gets the focus I get an error Runtime error 2465 Access can't find the field 'Form' referred in your expression.
Have tried many permutations but no luck.
Grateful for help.
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.
Thanks
Jon
Hi everyone!
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?
I have a form with 25 related sets of text-box controls:
Product1, ProdDescr1, ProdQty1
Product2, ProdDescr2, ProdQty2
... Product25, ProdDescr25, ProdQty25
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?
Hey everyone
This issue is holding me back now on 2 areas of my project :(
I need to know correctly how to reference a subform in a query.
Can someone please give me a working example for this:
main form: training courses
sub form control: course_dates subform control
sub form: course_dates subform
text box: course_date
I have tried:
[forms]![training courses]![course_dates subform control]![course_dates subform]![course date]
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!!!
Hi again
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
Am I using the wrong function?
I will keep looking around.
Thanks heaps
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. can i refer to a single record in a detail section, and not all of them? for example if i use something like this (after update in field1):
if me.field1 = 0 then
me.field2.enabled = false
any single field1 equal to zero will disable ALL of the field2's. i would like this to work within each record independently.
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
condition: [Forms]![Pkgsubform].[CrPkgStatus]="Accepted"
Action: SetValue
Item: [Forms]![pkgsubform]![Days2Process].[visible]
Expression: Yes
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
[Forms]![frmTestPkg]![frmsubcruiseplan].[Form]![crplanrecvdNo].[OnGotFocus]
--> 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.
View 1 Replies View RelatedActually in a powerpoint slide, I am having a set of 31 shapes having their names as numbers from 1 to 31.
How to refer by its name?
By hardcoding I refer it like this:
activepresentation.slides(1).shapes("1").someprope rty = somevalue
How to do it in a loop?
Code:
for i = 1 to 31
activepresentation.slides(1).shapes(i).someproperty = somevalue
next i
The above code will refer the shapes only by the index. But the shapes are not having index and name as same.
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
View 6 Replies View RelatedHi!
I've developed a form to be standalone. It's based on a query with filter like this:
Like "*" & [Forms]![myForm]![Fltr1]
(The Fltr1 is a combox value.)
Now when i place the form "myForm" as a subform in another form (FormMain), the query does not give me any data.
How do i refer to the filter from the query??
Any help will be much appreciated!
thanks ;)
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
I have a 'master' navigation form called 'NPYWC'
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)
I have tried a number of things. The latest being
Forms![NPYWC]![NavigationSubform].Form![Section].[Detail].Visible = True
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.