ok so i was having a look at the faq section and i found faq703-3936 located at http://www.tek-tips.com/faqs.cfm?fid=3936
it says
I hate writing the same code over and over like the code that loops through the items selected in a multi-select list box. This function will accept a list box...
the text box ony has 1 item, a programaticly generated string (format as outlined above), it is generated from a multi select listbox
yes it is the record soruce of a report
so what am i doing wrong?
yep you are right
so it ended up looking something like this
Private Sub Combo5_LostFocus()
Dim ctl As Control
Dim varItem As Variant
Dim Str As String
Set ctl = Me.Combo5
Str = """"
For Each varItem In ctl.ItemsSelected
Str = Str & "'" & ctl.ItemData(varItem) & "', "
Next varItem
Str =...
yes thats what i meant
so if i want after the entire thing is over
myString to read
"'xx1', 'xx2', 'xx3'"
how would i do that
note, its not going to read xx1 in real life that will be a parameter for a query
i.e Select ... where [...] in myString or is null
basicly i have the string, i...
how does that work? wouldnt access just assume the
myString = """"
is my string = "should be text in here" "should be text in here"
as " is the operator for literal text is it not?
I need to programaticly construct the string: "'xx1', 'xx2', 'xx3'"
what is the code for putting a ' in a string? and a "?
unfortunately ive never done this and cant find it anywhere in the access help files, but thats not unusual.
and how do i programaticly construct "'xx1', 'xx2', 'xx3'"
what is the code for putting a ' in a string? and a "?
unfortunately ive never done this and cant find it anywhere in the access help files, but thats not unusual.
I have a list box on a form. the reason i have used a list box instead of a combo box is that id like to be able to do multiple selections from the one control.
Basicly fill in the fields on the form click the run report button and the report will open use the values from the fields (one of...
My hero
Thanks PHV
what was i doing wrong?
p.s for the record you cant group by when selecting * ;)
thats why i was having such trouble understanding my problem, how could no grouping be the error when its not possible to do so in this situation???
...the sql sorted out now.
Private Sub Item_No_AfterUpdate()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strsql As String
strsql = "SELECT * FROM [Job Items]" _
& "HAVING [Project]= '" & [Forms]![NDrawing Entry]![Project] & "' AND [Partition]= '" & [Forms]![NDrawing Entry]![Partition]...
but it didnt work at all with the original brackets, said it was missing all 7 parameters required to run the query.
This time it actually shows me the parameters in the error message and they are the correct parameters.
is there somewhere i can read about the syntax of all this stuff. your help is great and greatly appreciated but its not really helping me understand all this any better.
why single and double quotes? what is the effect? where do i use each?
Private Sub Item_No_AfterUpdate()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strsql As String
strsql = "SELECT * HAVING Project= " & [Forms]![NDrawing Entry]![Project] & " AND Partition= " & [Forms]![NDrawing Entry]![Partition] & " AND Section= " & [Forms]![NDrawing Entry]![Sect] & "...
im not selecting every field, or i would have use select *.
Thanks so much for your help im booked in to do a course on this stuff in a few weeks, but i still need to get this done before then. ;)
this is the vba code
Private Sub Item_No_AfterUpdate()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strsql As String
Set strsql = "SELECT Project, Partition, Section, Sub Section, Drawing No, Max(Revision) AS Rev, Type, Job, Item No, Item Name, Quantity, Supplier, Status, Due Date...
the form is open, im calling the vba from a subform of the form in quetion, the form is open and the required data is in the fields.
if i go to the queries window and double click the query in question i recieve the results in looking for.
also if i use vba to open the query, that works too...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.