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...
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!
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...><
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....
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...
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=" &...
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...=(
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
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!!
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
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")...
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 =...
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...
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...
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!