Re: Different data shown based on user input
- From: "Jeanette Cunningham" <nnn@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 1 Jan 2008 16:51:21 +1100
Hi,
are you using code to do this and not a macro?
The basic process is to build the query using the fields that have been
ticked one checkbox at a time.
Here is an example:
Private Function BuildQuery
Dim strStub as String
Dim strSQL as String
Dim lngLen as Long
strStub = "SELECT tblEmployees.Name, "
If me.chk1 = True then
strStub = strStub & "tblEmployees.Address1, "
End if
If me.chk2 = True then
strStub = strStub & "tblEmployees.City, "
End if
'continue for all the checkboxes
'build the query string by removing the trailing comma and space
lngLen = Len(strStub) -2
If lngLen > 0 Then
strStub = Left$(strStub, lngLen)
End If
'Debug.Print strStub
If len(strStub) > 0 Then
'build the rest of the query such as the from, where and orderby clauses
'export the query
strSQL = strStub & "rest of the query"
Else
End if
End Sub
Jeanette Cunningham
"Maver1ck666" <Maver1ck666@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:748FF996-5734-4CB8-B3EC-A8D121412B3C@xxxxxxxxxxxxxxxx
Bit of a strange one for you.
I have a form which has a number of different tick boxes (unlinked to a
recordset). Each tick box represents a field within a number of different
tables.
What I want to do is to have a user tick a number of fields and click a
button which will export only the fields they have ticked/selected into an
excel spread***.
Does that make sense? Let me know if you want me to explain it any better.
Cheers for the help.
Maver1ck666
.
- Follow-Ups:
- Re: Different data shown based on user input
- From: Maver1ck666
- Re: Different data shown based on user input
- Prev by Date: RE: if >= to, then...
- Next by Date: RE: if >= to, then...
- Previous by thread: RE: if >= to, then...
- Next by thread: Re: Different data shown based on user input
- Index(es):