473,320 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to select a report from a Combobox

547 512MB
I created a table listing all the different reports/forms and Crosstab queries i require, and wants to select the relevant reports/queries/or forms from there using the "after update" function, based on the Id field of the specific Report/Query or form in the "AllTblFinReports" table where i listed it.

When i use my vba code, it opens up all the reports/forms or queries at once.

finreports1 is a textbox using "=[finreports].[Column](0)" from the id field in the combobox

Expand|Select|Wrap|Line Numbers
  1.  If IsNull(Me![facility1]) Then
  2. Exit Sub
  3. Else
  4. If Me.finreports1 = "1" Then DoCmd.Minimize
  5. DoCmd.OpenForm "frmViewcaptTrans", acFormDS, "", "", acEdit, acNormal
  6. If Me.finreports1 = "2" Then DoCmd.Minimize
  7.   DoCmd.OpenForm "frmPharmTopmedsCnt", acFormDS, "", "", acEdit, acNormal
  8. DoCmd.Maximize
  9. If Me.finreports1 = "3" Then DoCmd.Minimize
  10.  DoCmd.OpenForm "frmPharmTopmeds2", acFormDS, "", "", acEdit, acNormal
  11. DoCmd.Maximize
  12. If Me.finreports1 = "4" Then DoCmd.Minimize
  13.     DoCmd.SetWarnings False
  14.     DoCmd.OpenQuery "UpdateNPITID2", acViewNormal, acEdit
  15.     DoCmd.OpenQuery "UpdateNPITID3", acViewNormal, acEdit
  16.     DoCmd.OpenQuery "UpdateNPITID4", acViewNormal, acEdit
  17.     DoCmd.OpenQuery "UpdateNPITID5", acViewNormal, acEdit
  18.     DoCmd.OpenQuery "UpdateNPITID6", acViewNormal, acEdit
  19.     DoCmd.SetWarnings True
  20.     DoCmd.OpenReport "rptNPConsumeSummary", acViewPreview, "", "", acNormal
  21.   If Me.finreports1 = "5" Then DoCmd.Minimize
  22.     DoCmd.OpenReport "rptfutureexpire", acViewPreview, "", "", acNormal
  23.     DoCmd.Maximize
  24.     End If
I have tried all sorts of configurations with "elseif" and "else" and with "end if" without success.
Any suggestions will be welcomed please
Jul 17 '13 #1
1 1103
neelsfer
547 512MB
I am a fool - got it working by adding "end if" after each "if then" statement
Maybe somebody else can also learn from this "oversight"
Jul 17 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Nick Douglas | last post by:
I have a table with 50 fields, and a combo box which is set to 'field list' to read the field names. I want to select report groups via another combo box based on the field names the user selects....
4
by: Gene Hubert | last post by:
I'm looking at using the result of DataTable.Select as the DataSource for a ComboBox. Is there an easy way to do this with a minimum of code. I tried to bludgeon it into submission by writing:...
0
by: Rahul Chatterjee | last post by:
Hello All I have designed a dotnet application using VB which basically takes a selection and passes value to a crystal report which in turn passes the value to a Stored procedure. After the...
6
by: Evan Camilleri | last post by:
How do I add a column 'Select...' to a databound Combobox? ... So that users will see that? In windows application. Evan Camilleri
4
by: c_shah | last post by:
I am a beginner and learning VB.net There are two wasy to bind a combobox or a listbox First approach is to assign a datasource and displaymember Second approach is to iterate through datarow...
2
by: jodleren | last post by:
Hi! I use this to read on the value of my "parent" window. stemp=window.opener.document.forms.workgroup.value; Works well. Say, I'd like to add an items to that, and select it?
3
by: Gilberto | last post by:
Hello, I need the user to be able to select the language of some reports. Right now every product has already its current french and english name. And I was about to simply create another whole...
6
by: alphaomega3 | last post by:
I'm back with a new set of problems with the old NCR database from a year ago. I have a form that is for Nonconformance Entry. In the process of entering this form if the supplier for the...
2
by: yogeshtiwarijbp | last post by:
Hi All, Iam new in asp.net 2003 and sql server. I have to create an application having following criteria. Proposed Steps 1. Create a table containing fields as Name of Report, View Name or...
1
by: sjarmy | last post by:
I am using javascript to make a dropdownlist act like a combobox and it is work well. The issue I'm having is when the user types in the combobox and finds the selection he wants, he has to use the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.