User Profile

Collapse

Profile Sidebar

Collapse
julietbrown
julietbrown
Last Activity: Jun 9 '11, 01:41 PM
Joined: Jan 8 '10
Location: Swindon, UK
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Why doesn't Python recognize list element equal to input string?

    This is a bit embarrassing, but I'm new to Python, and using Python 3.2.

    This is the problem code:

    Code:
    #a list of names
    Names = ["", "", "", "", ""]
    #initialised thus ...
    Names[1] = "Fred"
    Names[2] = "Jack"
    Names[3] = "Peter"
    Names[4] = "Kate"
    
    Max = 4
    Current =
    ...
    See more | Go to post

  • That's spectacular! Thanks so much.

    And there was I feeling all chuffed that I'd managed to write a dodgy little function to be called absolutely 1000s of times to 'package up' any apostrophes to hide them away from SQL. Now, thank God, I don't need it!
    See more | Go to post

    Leave a comment:


  • This seems to have taken off while I was asleep! So far none of the things suggested actually work just as suggested, but I think that's because my code is too complicated and I need to think out more carefully what's actually going on and what needs to go on: currently in danger of desperate hacking!! I've made a note of all the suggestions and am saving them for when I re-attack this problem.

    Thanks to everybody.
    See more | Go to post

    Leave a comment:


  • How do you handle strings containing apostrophes in SQL?

    The following SQL statement 'runs' fine unless one of the strings rstContact!Firs tNames or rstContact!Fami lyName contains an apostrophe. I can see why this causes a syntax error, but don't know how to cure it!

    Code:
      
    "INSERT INTO TEMP_NOT_GOT_SMI (ContactID,FirstNames,FamilyName,OrganisationID) VALUES (" & rstContact!ContactID & ",'" & rstContact!FirstNames & "','" & rstContact!FamilyName
    ...
    See more | Go to post

  • julietbrown
    replied to SQL Syntax Error
    The number of fields won't make any difference as long as the bit in brackets ... (Username,Time1 ) ... has the same number of fields in the same order as the stuff in the VALUES brackets, (and of course UserName and Time1 must be names of fields in the table)

    If Time() is a date/time function you could try

    strSQL = "INSERT INTO tblUserLog (Username,Time1 ) VALUES ('" & lblUsername.Cap tion & "',#"...
    See more | Go to post

    Leave a comment:


  • julietbrown
    replied to SQL Syntax Error
    Try this ...

    strSQL = "INSERT INTO tblUserLog (Username,Time) VALUES ('" & lblUsername.Cap tion & "'," & Time() & ")"

    The messy stuff about single and double quotes and strings inside sql strings is a source of huge confusion to me, too! I think making more substrings has made your Insert statement even more difficult to unravel.
    See more | Go to post

    Leave a comment:


  • Nope! I think the problem is that when the items are moved off the list it shuffles through to take them out and move the others up into the gaps, and it does that starting from the top and working all through to the bottom ... where it stops, and stays. What's required is some instruction to tell it to scroll itself back up to the top ... something called ResetList or something, but this method doesn't appear to exist!
    See more | Go to post

    Leave a comment:


  • Sadly, this works only for non-multiselect list boxes. Multiselect ones don't have this nice simple ListIndex property. But thank you for a having a try at it! I will continue to ponder ...
    See more | Go to post

    Leave a comment:


  • julietbrown
    started a topic How can I stop a list-box from scrolling?

    How can I stop a list-box from scrolling?

    I have two multi-select list boxes. The user can make a selection from list-box A, and click a button to move the selection into list-box B. The problem is that when list-box A is requeried so that the selection disappears list-box A insists on scrolling down so that it shows only the last items in the list. I really don't want it to scroll at all, but if it must I'd rather it scrolled back to showing the first items, not the last.

    ...
    See more | Go to post

  • Thanks lots, that's great. Hope I haven't sent two thankyous by mistake: I stopped to click best answer while replying and I think my reply disappeared! Anyway, you deserve at least two thankyous.
    See more | Go to post

    Leave a comment:


  • When tab key is pressed, can I detect the current field?

    I want my user to be able to tab through fields on a form, but NOT move to a new record when tabbing gets to the last tab-indexed field. I can detect when tab is pressed within the KeyDown sub, but I don't know how to pick up when the last tab-indexed field has been reached, or how to set the tabbing back to '1' again at that point. Can anyone help?
    See more | Go to post

  • julietbrown
    started a topic How to disable CTRL-S, but not CTRL-C/CTRL-V

    How to disable CTRL-S, but not CTRL-C/CTRL-V

    For complicated reasons, I am disabling Ctrl-S on a form, so that users have to use the Save button. I have the following code, which works fine:

    Code:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
        Select Case True
        Case (Shift = acCtrlMask)
            Beep
            KeyCode = 0
        Case ((Shift = 0) And (KeyCode = vbKeyCancel Or KeyCode = vbKeyReturn Or KeyCode = vbKeyEscape))
    ...
    See more | Go to post

  • julietbrown
    replied to Make ACCDE problem in Access 2007
    Reply from myself ... which should include some very rude words directed at myself but I'd better not use them.

    Anyway, I'm a prat, because there are errors in my code so it won't compile ... However, as usual the Make ACCDE 'help' was stunningly unhelpful. It should have said "The most likely reason for failing to create the ACCDE is that there are errors in your code" ... not all that stuff about huge databases!!!
    ...
    See more | Go to post

    Leave a comment:


  • julietbrown
    started a topic Make ACCDE problem in Access 2007

    Make ACCDE problem in Access 2007

    Looking ahead, I decided to try splitting my db and compiling the front end. So I tried it on a copy of my current db.

    I managed to split the db successfully, but then I wanted to compile the front end. Access refused to do it. The 'help' said it was probably because the db is "too big", but this seems wildly unlikely to me. I have about 40 queries, 40 forms and 30 reports, whereas 'help' is talking about thousands???...
    See more | Go to post

  • Thank you very much. That's great. This is a nice bit of code for my 'how to' library!

    However, whenever one of you experts says "I'm not sure I fully follow the logic of what you're trying to achieve here Juliet", I usually start to think it's probably something mad I'm trying to do, and re-think the overall approach, as I did here.
    See more | Go to post

    Leave a comment:


  • julietbrown
    replied to ListBox.ListCount property problem
    I was asked to 'choose a best answer'! But in this case, there really isn't one. It remains mysterious. But the work around was to DCount the relevant records in the underlying table ... so I guess that's my own best answer!
    See more | Go to post

    Leave a comment:


  • How can I trap clicking of 'Cancel'/hitting CTRL + Z?

    If user uses CTRL+S to save, instead of my Save buttons that is fine, because the before and after update subs run for both ways of saving.

    However, if user uses CTRL+Z, instead of my Cancel buttons, disaster strikes!
    In one form in particular, it's a big problem. By the time a whole record has been put in, if the user clicks Cancel quite a lot of processing needs to be undone, and it all works fine, but this code is in the...
    See more | Go to post

  • julietbrown
    replied to ListBox.ListCount property problem
    I will try to explain! When a new 'Event' record is created and saved, the system generates a set of standard document titles associated with it (e.g., one is 'Invitation ...') and displays them in a listbox on the form. But, of course, when an Event is just edited, you don't want the system to create these again (to make two copies of all of them). So, my AfterUpdate routine looks to see if the set of docs is empty, and if it is it knows to create...
    See more | Go to post

    Leave a comment:


  • julietbrown
    replied to ListBox.ListCount property problem
    Sadly, I already tried your suggestion!! So, I know that's what it "thinks". I've tried all sorts of dubious things to encourage it to think differently, and it does as long as it's not a new record, even though the row source is just the same under those circs. Well, I'll let you know if/when I find a solution. It's very annoying as it's quite a critical issue for me.
    See more | Go to post

    Leave a comment:


  • julietbrown
    started a topic ListBox.ListCount property problem

    ListBox.ListCount property problem

    Puzzled!
    I have a list box, and I want code to behave in a particular way according to whether the listbox is empty (no rows displayed) or not.

    I have written ...

    If MyList.ListCoun t = 0 then do something, else do something else

    This is refusing to work properly under some circumstances, as follows ...

    (I've put in a message box to tell me what the code thinks the list count...
    See more | Go to post
    Last edited by julietbrown; May 4 '10, 03:24 PM. Reason: ambiguous punctuation!
No activity results to display
Show More
Working...