Search results

  1. S

    Splitting uneven text field.

    Hi, Missing a ) UPDATE table_name SET YourFieldName = IIF(Right([YourFieldName],1) = "," , Left([YourFieldName],Len([YourFieldName])-1), [YourFieldName]) That should work Simon B.
  2. S

    Need help with SQL error

    hi, I don't see anything right now... but I can give you one trick: always build your query in a string and then pass the string as an argument. You can then do a "Debug.Print strQuery" and troubleshoot the exact query that gets executed... Simon B.
  3. S

    Need help with SQL error

    damn telephone while I'm typing.... :)
  4. S

    Need help with SQL error

    Hi, Quotes? DoCmd.RunSQL "INSERT INTO tblGeneralItems (ItemCode, ItemDesc, Species, SubSpecies, Note) VALUES (04211, 'Chicken Trim', 4, 211, 'Added By Sys');" Assuming that the data types match I don't see aything else... Simon B.
  5. S

    Splitting uneven text field.

    Hi As for the splitting, if your format is always ends with ..., Address, City, Province(?), Postal Code(?), then you can use Split() as DCrake suggested and go backwards for filling the fields (postal code, province, city, etc.) Simon B.
  6. S

    Splitting uneven text field.

    Hi, You could do an Update query to correct what is already in your table: UPDATE table_name SET YourFieldName = IIF(Right([YourFieldName],1) = "," , Left([YourFieldName],Len([YourFieldName])-1, [YourFieldName]) That will "clean up" your trailing "," in your table. Simon B.
  7. S

    Grabbing the year from a date entered as a parameter

    Is YTD a field in your table or is it calculated "on the fly"? Sounds to me as it is asking for the YTD in the SELECT line...
  8. S

    Grabbing the year from a date entered as a parameter

    Hmmm.... Everything seems right to me... Might sound stupid but is your form open? Maybe others can help you out on this one. Simon B.
  9. S

    Find date of previous Sunday

    Hi, That would work although there might be some other way of doing it: Public Function LastSunday() As Date Dim myDate As Date myDate = Date While Weekday(myDate, vbSunday) <> vbSunday myDate = myDate - 1 Wend LastSunday = myDate End Function
  10. S

    Grabbing the year from a date entered as a parameter

    Hi, Here is what I would do: Place an input mask on [Forms].[Form1]![StartDate] to make sure the date is entered in the expected format (mm/yyyy). Then in your SQL: ... WHERE YTD = Right([Forms].[Form1]![StartDate], 4) & " YTD" ... HTH Simon B.
  11. S

    default date field to 01/07/yyyy

    Hi, You are not specifying any values if the condition is not met. I suppose it will use "null" in that case. Change your IIf to this: IIf(Left([Field3],6)="00/00/",DateValue("01/07/" & Right([Field3],4)), [Field3]) Hope that helps, Simon B.
  12. S

    CopyFile error

    Hi, I THINK that copyFile will not overwrite... You will probably need to test if the file exist and delete it before copying... Simon B.
  13. S

    update several fields in table_a from table_b based on a text field match

    Hi, Here is the correct syntax: UPDATE table_a, table_b SET table_a.x = table_b.1, table_a.y = table_b.b, table_a.z = table_b. WHERE table_a.xx = table_b.dd ; HTH Simon B.
  14. S

    work through and replace numbers with txt on comma delimited fields

    Hi, Correction in RED: Decode = Decode & DLookup("[Decodes].[CodeName]", "DataDump", "CodeNumber = " & Trim(strCode(i)) & _ " AND [Decodes].[CodeName] = '" & strDecodeSet & "'") However, the DLookup doesn't look good to me... In pseudo-code: DLookup(decoded_text_field...
  15. S

    work through and replace numbers with txt on comma delimited fields

    Hi, In that case modify the function to pass the set as a 2nd argument and use it in the DLookup criteria. Something like: DLookup("DecodedTxt", "Table2", "CodeNumber = " & Trim(strCode(i)) & " AND decode_set = ' & strDecodeSet & "'") You would then call the function like this in you SQL...
  16. S

    work through and replace numbers with txt on comma delimited fields

    Hi, Do you mean that right now you have 13 decode text with ID 1 (for example)? If so the lookup will get you the first ID it finds and god knows in which order it searches... But yes it would be possible to have many conditions, perhaps you could include the MVx in your first table and then...
  17. S

    work through and replace numbers with txt on comma delimited fields

    Hi, This should work: Public Function Decode(strCodedField As String) As String Dim strCode() As String Dim i As Integer strCode = Split(strCodedField, ",") Decode = "" For i = 0 To UBound(strCode) If Decode <> "" Then Decode = Decode...
  18. S

    grabbing an ID from one table using another field

    Hi, updateuser = "UPDATE tbl_users, basedata SET tbl_users.hourspw = '" & newhours & "', tbl_users.ID = basedata.ID WHERE (tbl_users.name = '" & personsname & "')" 'AND [Start_Date] > DateAdd("m", -12, Date()) AND [absentcode]='countme') AND tbl_users.ID = basedata.ID" CurrentDb.Execute...
  19. S

    Using IF and OR in the same statment?

    Hi, Why dont you go the other way around? if teacher = president or teacher = director then 1 signatures else 2 signatures endif Simon B.
  20. S

    Create Log In and Password Page

    Hi, Do every user log on their computer with a different login name? If so you could use Environ$("Username") to get the login they used. Then create a table with those logins and their full names to be displayed. The table can also be used to control access to the database (or specific...
Back
Top Bottom