Forms :: Textbox To Perform Dlookup If Checkbox Is Checked?
Sep 9, 2013
I have a text box on a form, currently it performs a dlookup for me. I want to change it so that it only performs the Dlookup if a checkbox is checked, but otherwise will display the text that's in an unbound text box.
Not 100% this is even possible, but hoping so. So far I have in the textbook:
The dlookup works fine by itself, it's just making it conditional that's causing me problems. I know it could just be a small problem with the way I've written it, or it could be a bigger thing with me not understanding the way IIF works.
I've searched the forum for my problem and the closest i got was this and it doesn't help that much
If this is the code you can put on click for a checkbox to hide a textbox. If me.YourBoosterCheckBoxName = -1 then 'need the shot so hide the other textboxes me.TextBox1.visible = false me.TextBox2.visible = false 'etc.... else end if
How do you make a code for a checkbox to SHOW a textbox?
I am having a problem with making a textbox visible on a form if a checkbox is checked on the same form. I have done research on this site and have written the code below, but I am getting a Syntax error, see yellow highlight.
- My checkbox is named: Case is a Readmission from WRCA IP to WRCA IP - My textbox is named: Date of Current IP Admission (I have defaulted this textbox to not visible).
Here's the code I have written:
Private Sub Case_is_a_Readmission_from_WRCA_IP_to_WRCA_IP_Clic k() If Case is a Readmission from WRCA IP to WRCA IP =true then Date of Current IP Admission.visible=true Else Date of Current IP Admission.visible=false
My tab name is SPA and it is the third tab in my form. I want to hide it if the AddToSPA checkbox is checked. This is what I have but I'm getting error 'Compile error: Method or data member not found"
Code:
Private Sub Form_Load() If Me.AddToSPA = True Then Me.SPA.Pages(2).Visible = True Else Me.SPA.Pages(2).Visible = False End If End Sub
I am trying to write an IF statement as a macro on the OnClick property of a checkbox and can't get it to work. Basically, if the checkbox is checked (for Yes) I want it to open another form. (The checkbox is a field on a subform on a form).
I haven't even gotten this far yet, but I would also like the IF statement to include an AND somehow....in other words I want the IF statement to basically say if the box is checked for yes AND the offer status field ="Accepted", then open another form. If either is False, then I don't want it to do anything except display a message box saying they can't initiate a contract is both conditions aren't true.
I have a checkbox that when checked returns all of the yes values for the column but I want it so that when it isn't checked, it doesnt search for this criteria at all, is there a way of doing this? I tried option buttons too but I wasn't sure of how to go about it.
I am trying to create a medical records inventory. We have physical charts which each have a barcode and I have a scanner. The idea is to have employees who want to check the chart out scan their barcode (on their badge), scan the chart's barcode and leave.
I have a table called tblCharts with the fields: ID (primarykey which is also the chart number), a checkbox, Employee ID, Date, and Time checked out.
I have Employee ID linked to my tblEmployees that simply has a listing of the employee ID's and first and last names. I don't care about keeping a record of who has had the chart in the past.
I just can't figure out how to tell the checkbox to be checked (to indicate the chart is out) when a number is added to the ID field (via scanner).
So here's how it would go:
Scan the chart's barcode which would populate into the ID field. Search to see if the record with the same number is already existing, if not create a record. IF it does exist, check to see if the checkbox is checked. If it is checked then the chart is being checked back in (so uncheck the box). If it is not checked to begin with (still in), then check it out and associate the employee's scanned barcode with it.
I have a Mainform [FrmReconcileMain] and it contains a Subform [FrmReconcilesub]
What I'm trying to is, on the Main form type in a statement date in textbox [TxtStatementDate].
I have a checkbox on my subform [ReconciledYN], along with a textbox [TxtReconcileDateSub]. when I click the checkbox, it simply pulls the date from the mainform and populates the date in the subform.
I've even tried experimenting on a simple form (with no subform) to see whats going on, but still I can't get it to work, even on a simple event such as this...
If [yourcheckboxname] = -1 Then [controlnametoupdate] = date() Else [controlnametoupdate] = ""
Access 2010 - I would like to use DLookup to show results values from a table and display in a unbound textbox on a form. the results from each column in the table need to be on seperate lines, a break if you may. Here is the code I have so far.
I'm trying to find a code that will allow me to check a value of a yes/no checkbox based on a username.
What I want to happpen is:
1. The code looks to see if the username that is entered in "txtUsername" field on the form matches the "empUsername" value on the table "tblUsers." 2. If there is a match, I want it to look at the value for the field "Admin" on "tblUsers" to see if the value is checked as true. 3. If the value is true, I want it to open a specific form "frmAdmin." If it is false, I want it to open a form "frmMain."
VBA codes not recognizing the Admin field and instead taking all users into the frmMain.
I'm guessing that this will take coding and I don't know coding very well. I have 4 categories...I'll call them A B C D. For each category, there is 3 text boxes, EX: A Cost, A Refund, A Rec Date I will have a checkbox for when each is rec. but not all accounts will have every category(A, B, C, D). I'm trying to get the checkboxes for each category to be disabled if and only if the Category(A, B, C, D) Cost is NULL or 0.
I have 44 checkboxes, each has a textbox next to it. What I want is when the user selects a checkbox, the textbox next to it will be enabled. Also, when the user unselect a checkbox, the textbox next to it will be disabled and any value entered is cleared.
Another way is whenever the user enters a value in a textbox, the checkbox associate with it is selected and vice versa.
I have a form with three items:a checkbox called "Check231", a textbox called "text921" and another textbox called "text762".
What I wish to do is: Enter text in textbox921, which stays the same as I scroll through each record. Then If checkbox check231 is checked, it displays text from textbox921 to textbox762. Textbox762 is bounded to the form.
I'm using Access 2010. I'm having trouble with dlookup.
Table name: tblTier2 Fields: Tier2ID, autonumber Tier2FieldType, text
I have an unbound list box on a main menu form.
The listbox control is numeric and called: lstItem
I tried putting the following in the textbox:
Neither of these worked: = DLookUp("[Tier2FieldType]","[tblTier2]","[Tier2ID]=" & [lstitem]) =DLookUp("[Tier2FieldType]","[tblTier2]","[Tier2ID]=" & [lstitem].[column](0))
I wanted to see if the lstItem was the problem, so I put ths following in the text box. : =[lstitem] (it returned the ID number selected from the list box, e.g., 809)
My bound master form has bound subform in it and both of them has linked fields. In the master form i've placed a checkbox which if unchacked will lock and disable a textbox in the SUBFORM, and if checked will enable and unlock the textbox and fill it with a calculation result, which will then be passed on to the underlying table.
Now, suppose in the master form (named X), i have A (checkbox) and B (textbox with numeric value) and in the subform (named Y), i have C & D (both textboxes with numeric values). Hence if A is checked, I'd like D to return the result of - "B*C". Or else D will remain locked and disabled.
I have my setup all complete and everything works great. Now, I have a subNavigation form within the Navigation form. Thing is, I am not sure how to go about the code for the query to pick up the Beginning and End Date to generate my report. Here is my Form setup:
frmNavigationForm (Main form) - Tabs on top. NavigationSubform (first Navigation Form, where I have a tab called Admin) frmAdminNav (where I have embedded under the Admin tab) - Tabs on left side. NavigationSubform (Second Navigation form where I have a tab called "Search") I don't recall what the name. How do I find it, stupid question, I know... frmSearch (where I am trying to pull a detailed report from date search criteria)
Here is one of the codes I have been trying to use in my Query and nothing seems to work.
Code: Between [Forms]![frmNavigationForm]![NavigationSubform].[Form]![frmAdminNav].[Form]![frmSearch]![BeginDate] And [Forms]![frmNavigationForm]![NavigationSubform].[Form]![frmAdminNav].[Form]![frmSearch]![EndDate]
tell me that can we use functional keys F1, F2,F3,,,,,,,,,,,,,,F12 in ms access to perform commands like saving a form data , for closing form refreshing form, clear form.Or is there any way to make shortcut keys combination like[(ctrl+s)(ctrl+c) (ctrl+A)] in access to perform action like saving,closing,clearing, current form.
I'm a novice when it comes to Access 2010, and I'm having trouble with DLookup syntax, and am going nuts. I have tblLookup, tblFees and Costs, and frmFees and Costs. All data entry is done in frmFees and Costs.
The tblLookup lists plaintiffs and the matter related to them. In the form, I made a combo box [Combo13] for plaintiffs and a text box for Matter [Matter], but whenever I enter the plaintiff, I get an error.
The error is: Run-time error '3075': Syntax error (comma) in query expression '[PlaintiffName]=The Plaintiff I Typed in'
The code I'm trying to use:
Private Sub Combo13_AfterUpdate() Me.Matter = DLookup ("[Matter]", "tblLookup", "[PlaintiffName] =" & Me.Combo13) End Sub
[PlaintiffName] is the column name in the tblLookup.
I looked around the forums but couldn't find anything that matched my setup.
I have a subform based on a query. That query contains a couple of calculations that end up in textboxes on the subform. The problem is that the calculations require me to enter 2 dates that are on the subform. If these are not entered before the calculation is performed I get a "Cannot update record" error message and then #error in both Lease cost and Discount Cost textboxes.
I have a textbox on a report that I wish to populate based on the value that is in another textbox/field on the report, and I thought DLookup was the way to go - however, I cannot seem to get it to work.
I have a table (ComplaintsResponses) that has two fields, both text
[ShortDescription] [ResponseText]
The text from [ShortDescription] is saved in a field on another table that contains all the other relevant information that is used in the report, and whilst this short description is mostly fine, I have one report where I need the data from the larger [ResponseText] field.