Hi,
another (stupid) question:
How can i edit an enty in a table that belongs to a DataBase via VBA ?
... without UPDATE queries at best ...
or is this not even possible ?
Thanks in advance and greetings,
...
Hi,
another (stupid) question:
How can i edit an enty in a table that belongs to a DataBase via VBA ?
... without UPDATE queries at best ...
or is this not even possible ?
Thanks in advance and greetings,
...
of course if you want to modify a specific record you'll have to define that in the openrecordset using either an updatable query or testing each record to see if it matches your search criteria.Code:dim db as database dim rst as recordset set db = currentdb set rst = db.openrecordset("TestTable") do while rst.eof <> true rst.edit rst.fields("FieldName").value = NEWVALUE rst.update rst.movenext loop rst.close set db = nothing
Hello,
thanks for this example. My problem seems to be that i can (for some reason) NOT access the "CurrentDb" ...
Gonna try further, but it seems not to work.
I am trying in an autogenerated Callback method for a control inside a Subform. Could that be the problem ?
What references do you have enabled?
I think the defaults are:
Visual Basic for Applications
Microsoft Access xx.x Object Library
OLE Automation
Microsoft Office xx.x Access database engine objects
if you have these references enabled in your VBA window you shouldn't have any problem.
Hi again,
here is what doesn't run ....
[code]
[code] ,.... didn't find the "code" - option ... now it workedCode:Private Sub cbo_ProjectName_AfterUpdate() Dim filter_param As String Dim ID As Integer Dim tmp_qry As QueryDef Dim tmp_tbl As Recordset Dim db As Database filter_param = "tblProjects.ProjectName = '" & "EinTest" & "'" ID = DLookup("ID", "tblProjects", filter_param) db = CurrentDb End Sub
the compiler moans about wrong usage of a field ...
If i just take out the last line "db = CurrentDb" it runs ... that's strange i think.
... got it ... added a "Set" ... settled ... however, the example is very useful.
Thanks