Search results

  1. K

    Question about JOIN!

    Hello, I want to link a table to 2 other tables in order to change its values. I wrote: CurrentDb.Execute "UPDATE Table1 INNER JOIN Table2 ON Table1.column = Table2.Column, Table3 ON Table1.Column = Table3.Column SET Column2 = Table2.Column2 WHERE Table3.Column = Table1.Column;" But is...
  2. K

    Is the DAY() function possible??

    Date: [Date1]-Day([Date1])+Day([Date2]) I know this has some problems with it...because it is not running...but can this be possibly done and if yes how? Thank you!
  3. K

    Data Type Mismatch???

    But I dont know how to make the output into a new table. using SQL its INTO TableName Can i do the same when running a saved query? thanks =)
  4. K

    Data Type Mismatch???

    I used the query builder to create the query, then copy and pasted the whole SQL into VBA. I need it in VBA because i need a series of actions to be done on the click of a button. I copy and pasted the whole thing so it shouldnt be wrong...that is why i am so confused now...><
  5. K

    Data Type Mismatch???

    Im trying to make a new table with selected columns and selected records. A simpler version maybe: SELECT Table.* INTO Newtable FROM Table GROUP BY Column1 HAVING Column1 = "Criteria" Im typing out the whole thing because I dont know where in the code it has gone wrong....
  6. K

    What is invalid use of Null??

    Thank you very much I'll give it a value of Zero for Nulls!
  7. K

    Data Type Mismatch???

    I have got problems runnign this SQL it says its got Data type mismatch... what does it mean and why is this happening?? Thank you!! Sqlstr = "" Sqlstr = Sqlstr & "SELECT IL4010DA.Pnumber, IL4010DA.Code, ([ValDate]-Day([ValDate])+Day([Pyd])) AS fdate...
  8. K

    What is invalid use of Null??

    When I run this code it says "Invalid use of Null", but all my vairables have values...i dont understand what it has got to do with Null...=( If tmpyr = "Y0" Or bus_type = "FB" Then r = 0 Else r = Max(0, DLookup(tmpyr, "CSV_" & bus_type, "Age=" &...
  9. K

    How can i UPDATE a column with a value input in tht FORM?

    CurrentDb.Execute "UPDATE ValuationDate SET Valdate = Forms![MainScreen].[InputDate].Value;" tmpvaldate = Forms![MainScreen].[InputDate].Value CurrentDb.Execute "UPDATE ValuationDate SET Valdate = tmpvaldate;" both of them didnt work...=(
  10. K

    Problem with UPDATE function

    Sorry forgot to rename... Pol is another table. It should be sth like this: MySQL = "UPDATE Table1 SET Column1 = Table2.Column1;" DoCmd.RunSQL MySQL
  11. K

    Problem with UPDATE function

    Is this not possible? MySQL = "UPDATE Table1 SET Column1 = Pol.Column1;" DoCmd.RunSQL MySQL If not, how can I do it? Thank you!!
  12. K

    Convert to SQL

    Or even sth like this with two conditions: If (rst![bsa] = 0) And (Left(Trim(rst![code]), 4) = "JYRP") Then rst.Edit rst![Rcode] = "JYRCI" & Right(Trim(rst![code]), 1) rst.Update End If
  13. K

    Convert to SQL

    Sorry 1 more question. what if i want to write If rst![prem] = 103.56 Then rst.Edit rst![prem] = 101.52 rst![eprem_o] = 2.04 rst.Update End If with two SETs. what is the format required? Thankyou very much!!
  14. K

    Convert to SQL

    I tried Currentdb.Execute "UPDATE Rid SET Rcode = [Pol].[Rcode] WHERE [Pol].[Pnumber]=[Rid].[Pnumber];" but doesnt work....:(
  15. K

    Convert to SQL

    How do i convert this into SQL?? Thanks =) rst.MoveFirst Do rst.Edit rst![ValDate] = Forms![MainScreen].[InputDate].Value rst.Update rst.MoveNext Loop Until rst.EOF rst.Close
  16. K

    Runtime Error 3001?!?!?!

    Hi, Thank you. but what if i want to put values from another table into the current table, how do i do it? Sub UpdateIL4010DB() Dim rst As DAO.Recordset Dim tbl As DAO.TableDef Dim db As DAO.Database Dim fld As DAO.Field Dim indx As DAO.Index Set db = CurrentDb Set tbl = db.TableDefs("Rid")...
  17. K

    Runtime Error 3001?!?!?!

    I have written the following code: Sub UpdateIL4010DB() Dim rst As DAO.Recordset Dim tbl As DAO.TableDef Dim db As DAO.Database Dim fld As DAO.Field Dim indx As DAO.Index Set db = CurrentDb Set tbl = db.TableDefs("Rid") Set rst =...
  18. K

    How to call Compact and Repair Database?!?!?!?!

    I wrote this to call compact and repair database between subs in the main module in order to keep the database under 2GB. However, when the program runs, MSaccess says "you cannot compact a database when running a macro/visual basic" i've run this code successfully before and i dont know why its...
  19. K

    How can I compact another database?

    If I want to compact and repair the current database, I write: Sub CompactAndRepairDatabase() CommandBars("Menu Bar").Controls("Tools").Controls("Database utilities").Controls("Compact and repair database...").accDoDefaultAction End Sub But what if I want to compact and repair another...
  20. K

    How do i delete a linked table??

    If I want to delete a table that is in the database, I write: On Error Resume Next CurrentDb.TableDefs.Delete "Pol" But what if the table is a linked table? How do i delete the table/delete the link? Thank you!
Back
Top Bottom