Search results

  1. W

    Extracting numbers from a string

    Ahh...I see what you mean. Yes.
  2. W

    Extracting numbers from a string

    Umm...ok. Yes I think I've done that. This is what I have at the moment. Public Sub ExtractIntFromString2() Dim Phrase As String Phrase = "1 Day I went to see 5 elephants at the zoo. It was 25 miles away from my 4 bedroom house" Dim PhraseLength As Integer PhraseLength = Len(Phrase) Dim...
  3. W

    Extracting numbers from a string

    Hi, thanks very much for your advice but I am struggling with this. How do I put each number into a variable? And any 2 digit numbers would still be separated?
  4. W

    Extracting numbers from a string

    Ok. I've done that and this is what I have at the moment... Public Sub ExtractIntFromString2() Dim Phrase As String Phrase = "1 Day I went to see 5 elephants at the zoo. It was 25 miles away from my 4 bedroom house" Dim str As String, i As Integer For i = 1 To Len(Phrase) If...
  5. W

    Extracting numbers from a string

    Hi, Sorry to bring this up again but the previous solution doesn't quite work for my new problem. Basically I have strings that are not in a consistent format. For example, I would like to be able to extract the numbers from the phrase "1 Day I went to see 5 elephants at the zoo. It was 25...
  6. W

    Getting file path to a text box

    Thanks very much for your help. I manage to get FileDialog working and I have the file path to appearing in the text box. But how will I go about extracting just the file name from that path?
  7. W

    Getting file path to a text box

    Hi, I am looking for a way to allow a user to press a button and open up a browse window to select a file. Once selected, the file path will be put in a text box. I've already had a look on the net and found various solutions but I can't get any of them to work, including one very popular...
  8. W

    Accessing Form Objects in SQL

    I've tried that but that doesn't work in my design. Because the subform is not "linked" to the main form but rather it is built using a query as its object source. I've also tried re-querying the subform as well but that doesn't seem to work either.
  9. W

    Accessing Form Objects in SQL

    Thanks very much for that, I got it working! There's one problem though, when I update the sql the content of the subform doesn't change until I close the form and reopen it again. Do you know how I can get it to refresh?
  10. W

    Accessing Form Objects in SQL

    Thank you for the QueryDef idea. Do you mind elaborate how I would go about using it? I've never used it before and can't really find anything that useful on the internet. EDIT: Maybe I should elaborate myself as well. What I mean is, what goes where? eg. What goes in "YourQuery"?
  11. W

    Accessing Form Objects in SQL

    Thanks for showing that page, but I am still having a bit of trouble with it. At the moment this is what I have and when I run it, it doesn't give me an error but neither does it give me the correct results. SELECT [Forms]![frmMain]![lblVarName]![Caption] FROM tblData WHERE...
  12. W

    Accessing Form Objects in SQL

    Hi, I am just wondering whether its possible to have an sql query that will refer to the content of an object on the form? Basically something like this: SELECT me!cboSearch.Text FROM tblData WHERE tblData.&me!cboSearch.Text = 5; Thanks.
  13. W

    Extracting numbers from a string

    Hi everyone, Thank you for your suggestions. I guess the problem I am having is how to get the second number to append to a new variable. As en example the strings always looks like this: "12 To 40" or in some cases there's a decimal in it: "2.4 To 5"
  14. W

    Extracting numbers from a string

    Hi, Does anyone know how I go about extracting numbers from a string? At the moment I use a loop to go through a string and then use the IsNumeric function to extract any numbers in that string and put it in another variable. However, this only works if it was a single digit. However, what...
  15. W

    Looking through 1 column of a recordset

    haha, I guess I am still finding my way round vba and sql (and Access) at the moment so I know I am doing a things in a bit of an odd way at times. The example I use was only an example so I know it's not the best way to store data but I didn't want to bore you with the details! But if you...
  16. W

    Looking through 1 column of a recordset

    Hi yeah I should have been clearer. I actually manage to get it working by putting: If fld.Name = "CarModel" Then before the query. But the reason I've done it using vba is because I need to build a frontend that will allow the user to pick tables and columns.
  17. W

    Looking through 1 column of a recordset

    Hi, I have currently set my recordset to the following: Set rs = db.OpenRecordset("SELECT RecordNo, CarModel FROM tblCarData WHERE CarModel Like 'Ford*'", dbOpenDynaset) So that when I insert data into a new table I can output the RecordNo and CarModel but I only want to look through the...
  18. W

    Finding the highest value

    Thank you so much guys, you're a life saver!
  19. W

    Finding the highest value

    Yeah baffling me too. That's why I thought the variables are not resetting because if change my data to this: (-5) 3 (-5) 2 And 3 (-5) 2 and 3 And 4 then this is what I get: 0 0 3 0 5 0 2 3 0 5 0 2 3 4 5 Which would be correct. However, if I move the 4...
  20. W

    Finding the highest value

    Hi thanks for the reply. So I have explicitly declared the option variables as integer and I have set them back to 0 after print (I have actually tried this before) but it still doesn't work... my code now looks like this Public Sub HigherValue() Dim option1 As Integer Dim option2 As...
Back
Top Bottom