DoCmd Where Condition
The Admin Name is displayed on the report, however when I click on the text box pop-up appears 'AdminName' and a input box, if I typed in the name the form opens blank, what am I doing wrong?
Private Sub Cleansed_Click()
Dim AdminName As String
AdminName = Me.Admin_Name
DoCmd.OpenForm "Cleansed Clients", acNormal, , "[AdminName] = [Forms]![Cleansed Clients]![Admin Name]" End Sub
Thank you for taking the time to report an issue.
What's wrong... Please write below.
Is there a way around it? Am I missing something?
DoCmd.BrowseTo acBrowseToForm, "frmGuestInfo", "Main.NavigationSubform", "[GuestID] = " & lngGuestID
The secret was that I had to close the search form that was in use, so that the already open navigation form, "Main", would be visible, or the active form.
However, I cannot get the where condition to work at all. It has been some years since I worked with Access, so I'm sure I'm probably missing something simple, but I have tried many variations of ways to specify the where condition.
I was able to specify a filter on the form in question, frmGuestInfo, that worked as expected, but the same filter did not work when specified as the where condition of the DoCmd.BrowseTo command. lngGuestID does evaluate in code properly, so that is not the problem.
Private Sub RCRA_Continue_Click()
If Me.[dot_transport?] = "-1" Then
The condition is DOT_Transport? and the Form is frm_DOT while the report is Output.
For example, I wanted to create a receipt type report that would would open based on a transaction number. So I created a query that prompts for transaction number and then based a report on that query.
Now I am trying to get a button to perform some code (which I have already tested and is working) and open the report based on the transactions number. I would have thought I would need VBA to fill in the transaction number, but I can't get that syntax correct, and adding a where condition doesn't seem to work either.
Here is a sample of my syntax:
MsgBox "Would you like to print a receipt?", vbYesNo,
If vbYes Then DoCmd.OpenReport "Check_Out_Receipt_rpt", acViewPreview, , NextTransactionNum
ElseIf vbNo Then
MsgBox "Receipt will not be printed"
Where NextTransactionNum is a number that is populated via prior code my taking the max of the numbers in a particular field in a table and adding 1.
For example, the fields would be mostly say 31/08/2012 but one entry may be 30/07/2012. I want the code to pick this out and suggest whether I want to change this to 31/08/2012.
DoCmd.OpenReport "customer_account", acViewPreview, , "[nam]='" & Me.Combo4 & "'"
can I add another condition beside the one in the function. In other words, the last partion of the OpenReport function (condition) could be more than one.
Private Sub cmdHide_Click()
DoCmd.SelectObject acTable, , True
Private Sub cmdShow_Click()
DoCmd.SelectObject acTable, , True
It works but it needs two buttons, one for hide and one for unhide.
I guess there must be some way to combine them into one button with if statement or something like that.
But how do I know if DB window has been hidden or not? So that I can put it into if statement as condition? Or are there any other ways to do that
I have tried using the where conditon field in the macro and set it so the field value is equal to -1 but I still get the report with the #Error.
Is there a way to not have the report print when the second condition is not -1?
this is my code and I always get error 3075 missing operator or something and it's bothering me. I did this with a macro but now I need to do it with vb since the macro can't do as much some code can
I have a RunApp Action set up and would like to place an Iif condition next to it basically stating if today's date is a Saturday, quit application.
What I have tried is this and it does not work: Iif(Date(), "dddd")="Saturday"
I have the Quit Action below the RunApp Action, so if the condition is met it will quit the app, if condition is not met run the app