Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 17th, 2006, 06:35 AM
Friend of Wrox
 
Join Date: Dec 2005
Location: CHENNAI, TAMILNADU, India.
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default run an query through front end


 Hello Guy's

  I too feel that it is easy but some concept is not catching for me ,
 Fine plz solve my prob's , in my DB i have created an Query in which I created an parameter Name of the Equipment form this parameter i am taking the output of from the Qurey , But i want to take the same from the front end ....what i want to know is " I have created an from with combo box & an command Button from that i want to take the data by above said process. [ (i.e.) by selecting the name of the equipment form the combo box and clicking the buttom ]...
is it possible to using VB coding & macro if so .. Plz .. plz ..
 Give me the reply imdlly if u give me the solution ... then i can sleep well
 THank in advance ..
Bye,:)
Anuk p raguv

P.A.P.Raguv
  #2 (permalink)  
Old February 17th, 2006, 08:43 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

If you are using a query, then in the column in your query that matches the bound column in the combo box on your form, put this sort of criteria:

[Forms]![frmYourForm].[cboYourComboBox]

Then have the button either run the query, or open a report or form based on the query. The query will go fetch the bound column of the combo box and open run using that parameter.

You can also create the combo box, then create the button using the wizard and tell it to open the query, form or report based on a value on your form, and then associate the combo box with a column in your query, form or report.

Let us know if you need code.

HTH


mmcdonal
  #3 (permalink)  
Old February 18th, 2006, 03:11 AM
Friend of Wrox
 
Join Date: Dec 2005
Location: CHENNAI, TAMILNADU, India.
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default

Hi mc,
  I got it I got it ,.. it working and thanks a lot for ur help and u mentioned about the coding wat is that VB Coding ? . i learning VB pls send the coding so that i can use the coding for my development ..

 Bye ,
& thanks again...
P.Anuk prasanna Raguv
  #4 (permalink)  
Old August 3rd, 2006, 05:35 AM
Friend of Wrox
 
Join Date: Dec 2005
Location: CHENNAI, TAMILNADU, India.
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default

i want an clarification for the above statement ...i not getting now ..even though i selected the data in the combo box when i press command button asking perameter...

 its confusing ..

 do the needfull

Learn as you can..
------------------------
pap...
  #5 (permalink)  
Old December 19th, 2006, 12:33 PM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

I found this site from a search. I have a simliar problem, but I'm using txt boxes. This result works great if I just have one field in my table I'm trying to query, but I have 8. So I did the code provided above, and put that in the critera in all of my columns that I need to. However, it doesn't work if I have more then one listed in my critera, what do I need to do?

  #6 (permalink)  
Old December 19th, 2006, 01:09 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

What do you mean "more than one listed in [your] criteria?"

mmcdonal
  #7 (permalink)  
Old December 19th, 2006, 01:19 PM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay, I have 8 different dates in this table.. all of which I need to be able to query. So I made a txtbox named after each. Then put [Forms]![frmName].[txtName] to each corrisponding one. And one cmd button. The CMD button opens the query. But I have a feeling that if they only put 1 date in the any one of the txt box, the reason it isn't working is cause its passing a NULL to the rest of the dates and not finding any results

  #8 (permalink)  
Old December 19th, 2006, 02:40 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Okay, here is what you do:

Instead of using a text box for each date, use a combo box. That way the users can only select valid dates.

Then in the combo bo x query designer, make sure Unique Values is set to yes.

Then instead of adding criteria to the query, use the following code:

'--------------------------------
Dim dtDateOne, dtDateTwo ... dtDateEight As Date
Dim bCheck As Boolean

bCheck = False

If IsNull(Me.DateCombo01) Or Me.Me.DateCombo01 = "" Then
    dtDateOne = ""
Else
    dtDateOne = Me.DateCombo01
    bCheck = True
    sLink = "[DateOne] = #" & dtDateOne & "#"
End If

If IsNull(Me.DateCombo02) Or Me.DateCombo02 = "" Then
        dtDateTwo = ""
Else
        dtDateTwo = Me.DateCombo02
        If bCheck = True Then
            sLink = sLink & " AND [DateTwo] = #" & dtDateTwo & "#"
            Else
            sLink = "[DateTwo] = #" & dtDateTwo & "#"
            bCheck = True
        End If
End If

Etc...
'------------------------------

I hope that is clear. Then open your report using sLink in there WHERE section of the DoCmd.OpenReport line.

This will allow you to build a WHERE clause that is 8 parameters deep, and users can select one or all or none.

You may want to check the sLink string at the end if you want to make sure they enter at least one data parameter.

In that case, do this at the top:

Dim sLink As String

sLink = "" 'default anyway

Then after you take the conditions...

If sLink = "" Then
   MsgBox "Please select a date from one of the 8 combo boxes."
   Exit Sub
End If

Like that.

Did that help? I know it is not the most elegant thing, but it works for me in similar multi combo box situations.



mmcdonal
  #9 (permalink)  
Old December 19th, 2006, 02:41 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Sorry, this line:

If IsNull(Me.DateCombo01) Or Me.Me.DateCombo01 = "" Then

Should be this:

If IsNull(Me.DateCombo01) Or Me.DateCombo01 = "" Then


mmcdonal


Similar Threads
Thread Thread Starter Forum Replies Last Post
Front end Vs Back end ricmar Access VBA 3 May 27th, 2008 02:36 PM
Ms Access front End with Oracle 10g Back End rahul123 Oracle 1 July 9th, 2007 01:03 AM
Oracle back-end MS-Access 2003 client front-end Corey Access 2 February 16th, 2007 08:31 AM
Oracle Back End - MS Access Front End - Multi User ckaliveas Oracle 1 February 1st, 2007 06:00 AM
creating Front - End anukagni Access 8 April 22nd, 2006 04:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.