473,508 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combo Parameters in MS Access 2000???

8 New Member
Hi,

I am new to MS Access 2000, and i have designed one simple data base to keep record of people travelling every month

I can get the Report as a whole people as wizard report. but have tough time to get its own individidual report writing VB coding.. I want to select the individual from combo box and if possible date travel between can also be passed.


How do we pass the parimeter to get the own individual reports? Do any one have idea to write the MACRO or VB coding to get its own??

I would be very grateful for the simple answer.
Aug 27 '08 #1
13 1520
ADezii
8,834 Recognized Expert Expert
There are several ways to accomplish this, I'll give you my approach as a starter, and you can take it from there.
  1. Enter your Criteria for the Report on a Form, and validate the entries. Pass the Criteria for the Report in the OpenArgs Argument as a ',' Delimited String:
    Expand|Select|Wrap|Line Numbers
    1. Dim txtTDate As TextBox
    2. Dim cboEmp As ComboBox
    3.  
    4. Set txtTDate = Me![txtTravelDate]
    5. Set cboEmp = Me![cboIndividual]
    6.  
    7. If Not IsNull(cboEmp) Then
    8.   If IsNull(txtTDate) Then
    9.     MsgBox "You must enter a Travel Date", vbExclamation, "No Travel Date"
    10.       txtTDate.SetFocus
    11.   ElseIf Not IsDate(txtTDate) Then
    12.     MsgBox "You have not entered a valid Travel Date", vbExclamation, "Invalid Travel Date"
    13.       txtTDate = Null
    14.       txtTDate.SetFocus
    15.   Else
    16.     'We have a valid Traveler and Travel Date, proceed and pass the information
    17.     DoCmd.OpenReport "rptEmployees", acViewPreview, , , acWindowNormal, cboEmp & _
    18.                      "," & txtTDate
    19.   End If
    20. Else
    21.   MsgBox "You must select the individual who is traveling", vbExclamation, "No Traveler"
    22.     cboEmp.SetFocus
    23.     cboEmp.Dropdown
    24. End If
  2. In the Open() Event of the Report retrieve those Criteria, and also build a Record Source for the Report:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Report_Open(Cancel As Integer)
    2. Dim varInfo As Variant
    3. Dim lngEmpID As Long
    4. Dim dteTravelDate As Date
    5. Dim strSQL As String
    6.  
    7. varInfo = Split(Me.OpenArgs, ",")
    8.  
    9. lngEmpID = varInfo(0)
    10. dteTravelDate = varInfo(1)
    11.  
    12. strSQL = "Select * From Employees Where [EmployeeID] = " & lngEmpID & _
    13.          " And #" & dteTravelDate & "# Between [From] And [To];"
    14.             Me.RecordSource = strSQL
    15. End Sub
  3. Check and see if there are no Records that meet the Criteria, since you do not want to Open an Empty Report:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Report_NoData(Cancel As Integer)
    2.   MsgBox "There were no Records that matched the specified criteria", vbCritical, "No Records Found"
    3.     Cancel = True
    4. End Sub
  4. The previously listed code will allow a User to select an Employee (cboIndividual) and enter a Date (txtTravelDate). If will then see if the Employee is on Travel that Date by checking to see if it falls between a specified Range ([From] ==> [To]). The code is generic enough, make your own substitutions, and if you have any questions, feel free to ask.
Aug 27 '08 #2
rickzeen
8 New Member
HI Adeezi,

Thanks for your great help, the code has helped me little in giving some information and to generate report. But still i couldnot solve it though it would be trouble for you i would be helpful if u can just help me once again with those questions.

1. I did with all the codings in forms: but when i genereate report all the reports comes but not individual reports......so i did wrote the code in "Private Sub Report_Open(Cancel As Integer)"

as mentiuon by you. But this time this is error it comes. Type mismatch in "ID = varInfo(0)""


WHat couldbe the problem.


I want to explain you my table structure:

Table1:tblEmployee: with EmployeeID,Name, etc
table 2: tblCourse: with Course ID, EMployee id from tblemployee, Course Startdate, End date course, etc etc.


What i want is to to generate the individual report and another report which the people are travelled between any dates.


thanks for your kind help please
Aug 28 '08 #3
ADezii
8,834 Recognized Expert Expert
HI Adeezi,

Thanks for your great help, the code has helped me little in giving some information and to generate report. But still i couldnot solve it though it would be trouble for you i would be helpful if u can just help me once again with those questions.

1. I did with all the codings in forms: but when i genereate report all the reports comes but not individual reports......so i did wrote the code in "Private Sub Report_Open(Cancel As Integer)"

as mentiuon by you. But this time this is error it comes. Type mismatch in "ID = varInfo(0)""


WHat couldbe the problem.


I want to explain you my table structure:

Table1:tblEmployee: with EmployeeID,Name, etc
table 2: tblCourse: with Course ID, EMployee id from tblemployee, Course Startdate, End date course, etc etc.


What i want is to to generate the individual report and another report which the people are travelled between any dates.


thanks for your kind help please
Let's take one problem at a time.
  1. Error ==> Type mismatch in "ID = varInfo(0)""
  2. Is the EmployeeID that the Variable ID is referencing a String, Integer, Long etc., namely, what is the Data Type of [EmployeeID] in tblEmployee?
    What i want is to to generate the individual report
  3. What exactly do you wish Report1 to show? Explain logically, then list all Fields to be contained within the Report.
Aug 28 '08 #4
rickzeen
8 New Member
What ever may be, i am able to generate the individual report now after i did it with Macro. but not tat perfect.

WHat i want to display in report is:


i want the monthly report from course table with employee detail from Employeetables.

whats the parameters to pass to generate for example:fromdate:01/08/2008 = todate:30/08/08.


thanks for your help tooo
Aug 28 '08 #5
rickzeen
8 New Member
The 2 dates above should be in 2 text boxes.
Aug 28 '08 #6
ADezii
8,834 Recognized Expert Expert
The 2 dates above should be in 2 text boxes.
It's probably in the Syntax, try something like:
Expand|Select|Wrap|Line Numbers
  1. "Between #" & Me![txtStartDate] & "# And #" & Me![txtEndDate] & "#"
Aug 28 '08 #7
rickzeen
8 New Member
It's probably in the Syntax, try something like:
Expand|Select|Wrap|Line Numbers
  1. "Between #" & Me![txtStartDate] & "# And #" & Me![txtEndDate] & "#"

Adizeee, you are great programmmer compare to us. i too had some idea before but now due to limted time i couldnot now i have started doing it and after geting your help i could start a bit and atleast gettting something done from my side. well once more i would like to get ur help in this as said earlier.


1. Now i want to generate monthy report i mean from tbl course: we have to concentrate on 2 text boxes containing 2 dates any date: so if those dates enter is between and if there is dates in tbl course: field start date and End date

then have to generate the report.

so whats the full code: Do i need to write sql to get date from tbl:

though simple i m having touhg time.

so please help me

thanks
Sep 1 '08 #8
ADezii
8,834 Recognized Expert Expert
Adizeee, you are great programmmer compare to us. i too had some idea before but now due to limted time i couldnot now i have started doing it and after geting your help i could start a bit and atleast gettting something done from my side. well once more i would like to get ur help in this as said earlier.


1. Now i want to generate monthy report i mean from tbl course: we have to concentrate on 2 text boxes containing 2 dates any date: so if those dates enter is between and if there is dates in tbl course: field start date and End date

then have to generate the report.

so whats the full code: Do i need to write sql to get date from tbl:

though simple i m having touhg time.

so please help me

thanks
Assuming a 1 To MANY Relationship between tblEmployee(1) and tblCourse(MANY) on [EmployeeID], the SQL would look something like the following to list all Employees taking Courses within the Range specified by your Text Boxes. I must, however, warn you that SQL is not my strong point, and you will probably be better off with Replys from other Experts/Moderators, so let's stand by and see what happens.
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2.  
  3. strSQL = "SELECT tblEmployee.Name, tblCourse.[Course StartDate], tblCourse.[Course EndDate], " & _
  4.          "tblCourse.Title FROM tblEmployee INNER JOIN tblCourse ON " & _
  5.          "tblEmployee.EmployeeID = tblCourse.EmployeeID Where tblCourse.[Course StartDate] > = " & _
  6.          "#" & Me![txtStartDate] & "# And tblCourse.[Course EndDate] <= #" & Me![txtEndDate] & "#;"
Sep 1 '08 #9
rickzeen
8 New Member
Adizee,

Thanks for your great help, I have done with the reports and forms too. I have done as per the guidance of you and ur codings. i had done with great with your help. SOme i have done using macro too. thank u once more.

well now lastly i need to make this Database as Exe file. But how can i go about. I want to create EXE file and when run... the file should open one main form and navigate all other forms from that main form.I had some idea in converting that from access 2003. But not in 2007.

I created ACCDE file but when i open that file, it shows as same file no change. How do i make that file to open the MAIN form only and then navigate from it.


Thanks if u can help in that too.
Sep 2 '08 #10
ADezii
8,834 Recognized Expert Expert
Adizee,

Thanks for your great help, I have done with the reports and forms too. I have done as per the guidance of you and ur codings. i had done with great with your help. SOme i have done using macro too. thank u once more.

well now lastly i need to make this Database as Exe file. But how can i go about. I want to create EXE file and when run... the file should open one main form and navigate all other forms from that main form.I had some idea in converting that from access 2003. But not in 2007.

I created ACCDE file but when i open that file, it shows as same file no change. How do i make that file to open the MAIN form only and then navigate from it.


Thanks if u can help in that too.
  1. Tools
  2. Startup
  3. Display Form/Page ==> enter your Start Up Form Name
Sep 2 '08 #11
rickzeen
8 New Member
Adizee,
It has been great help from your side on developing the simple data base, well again i have developed one aspfile. which would retrive the datas in asp form. but when i retrive. the datas are all shown in page below .for eg. if submit the news now. that would just get at the end of page. so here is the retrival asp.code. how it is possible to make that the recent post are shown at the first line. not last.

Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly=0
adLockReadOnly=1
adCmdTable=2
Dim objConn, objRs
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRs = Server.CreateObject("ADODB.Recordset")
Dim strDatabaseType
strDatabaseType="Access"
If strDatabaseType="Access" Then
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Data Source=C:\Inetpub\wwwroot\Websites\Internal\Data.m db;" &_
"Persist Security Info=False"
End If
objRs.Open "datatable", objConn,adOpenForwardOnly,adLockReadOnly,adCmdTabl e

While Not objRs.eof

Response.write "<style=Arial narrow;Font size=7;color=#000066>"
Response.Write "<b><center>"
Response.Write objRs("topic")
Response.Write "</b></center>"
Response.write "</font>"
Response.write "<font color=#550000 face=verdana size=2>"

Response.Write objRs("details")
Response.write "</font>"

Response.Write objRs("submitted")&"<BR>"
Response.write "<font color= #CC0033>"
Response.write objRs("division")&"<BR>"
Response.write "</font>"

response.write"<b>"
response.write "Date posted "
response.write"</b>"
Response.write objRs("date")

Response.Write "<HR height=1 color=white>"

objRs.Movenext
Wend
objRs.Close
objConn.Close
Set objRs=Nothing
Set objConn=Nothing
%>
Sep 10 '08 #12
ADezii
8,834 Recognized Expert Expert
Adizee,
It has been great help from your side on developing the simple data base, well again i have developed one aspfile. which would retrive the datas in asp form. but when i retrive. the datas are all shown in page below .for eg. if submit the news now. that would just get at the end of page. so here is the retrival asp.code. how it is possible to make that the recent post are shown at the first line. not last.

Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly=0
adLockReadOnly=1
adCmdTable=2
Dim objConn, objRs
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRs = Server.CreateObject("ADODB.Recordset")
Dim strDatabaseType
strDatabaseType="Access"
If strDatabaseType="Access" Then
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Data Source=C:\Inetpub\wwwroot\Websites\Internal\Data.m db;" &_
"Persist Security Info=False"
End If
objRs.Open "datatable", objConn,adOpenForwardOnly,adLockReadOnly,adCmdTabl e

While Not objRs.eof

Response.write "<style=Arial narrow;Font size=7;color=#000066>"
Response.Write "<b><center>"
Response.Write objRs("topic")
Response.Write "</b></center>"
Response.write "</font>"
Response.write "<font color=#550000 face=verdana size=2>"

Response.Write objRs("details")
Response.write "</font>"

Response.Write objRs("submitted")&"<BR>"
Response.write "<font color= #CC0033>"
Response.write objRs("division")&"<BR>"
Response.write "</font>"

response.write"<b>"
response.write "Date posted "
response.write"</b>"
Response.write objRs("date")

Response.Write "<HR height=1 color=white>"

objRs.Movenext
Wend
objRs.Close
objConn.Close
Set objRs=Nothing
Set objConn=Nothing
%>
Sorry, but you will have to rephrase you question, I really do not understand its meaning. The following code is not necessary, since they are all Intrinsic Constants (built into Access):
Expand|Select|Wrap|Line Numbers
  1. Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
  2. adOpenForwardOnly=0
  3. adLockReadOnly=1
  4. adCmdTable=2
Sep 10 '08 #13
rickzeen
8 New Member
thanks

The question is: i have one form design in asp file which is to be submitted and the information are automically written to acccess database. there is no problem getting the information written to access database. And another is i have one asp file which i coded above is to retrive the information from access and then it gets displays in web form. like we acess the guestbook n all.

while it displays.......the recent submitted information are not getting to top page while it gets to down page. so the above code in asp is one which it gets displays.....whats the change in code to get displayed as newly submitted information to top page
Sep 11 '08 #14

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

Similar topics

5
3292
by: will eichert | last post by:
Greetings. I have a problem with a combo box incorrectly displaying blank items when returning to a form from a modal form. It's fine when the main form first comes up, but gets messed up when the...
0
1192
by: Aravind | last post by:
Hi folks. I am using Access 97. I have a form, frmHistory, which has 2 combo boxes (cboSelectTitle and cboSelectName) and 2 text boxes (Title and MemName). When the form is opened, it displays...
8
9827
by: Mark Flippin | last post by:
This is for a reporting problem using: Access 2000 SQL Server 2000 Both at SP3 I've a stored procedure in SQL Server 2000 which builds a result set from a disparate set of tables, utilizing...
1
2875
by: bonnie.tangyn | last post by:
Hello all I get Too few parameters expected 2 error and "The MS Jet Database engine cannot find the input table or query "myTempTablename". Make sure it exists and that its name is spelled...
3
2843
by: RICHARD BROMBERG | last post by:
I have a table (tblPhone) with text fields FULL, LAST, PHONE, I also have a combo box (cmboFull) . The row source for cmboFull is SELECT DISTINCT FROM tblPhone; Here's the code for the combo...
1
7175
by: vamoose | last post by:
Using MSAccess 2000. I have the frm_start combo box unbound and cmbWCoilNo Row Source Type set to Value List. The following code populates the variable strCombo with some values but gives me an...
7
3993
by: Ceebaby via AccessMonster.com | last post by:
Hi All Here's hoping someone can help me with this. I have a report based on a query where the criteria for 4 of the fields is set from an unbound form. I want the user to be able to select any...
8
1421
by: =?Utf-8?B?TWFuanJlZSBHYXJn?= | last post by:
Hi I am trying to access a combobox of a dialogbox. The code is someting like that: void CDatabaseView::OnAddExpdata() { CExpDataDlg dlg; CComboBox* pCmbBox = static_cast<CComboBox*>
30
26444
ADezii
by: ADezii | last post by:
This week’s Tip of the Week will clearly demonstrate how you can dynamically set the Drop Down List Width of a Combo Box to the length of the longest item in its Row Source. The inspiration for this...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7499
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5055
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.