f_o_o_k_y
asked on
Accessing current recod data form VB
Hello,
When I'm creating form based on query I have all fields added automaticly to my form.
I want to delete for example someID field (textbox) but I still need to access this field from my VB code.
Can I access current record data somehow???
I dont know VB much but meybe somthing like Me.Recordset.column("someI D");
Best Regards
fooky
When I'm creating form based on query I have all fields added automaticly to my form.
I want to delete for example someID field (textbox) but I still need to access this field from my VB code.
Can I access current record data somehow???
I dont know VB much but meybe somthing like Me.Recordset.column("someI
Best Regards
fooky
You can do it like this https://www.experts-exchange.com/questions/21708559/OleDbCommand-DELETE-WHERE-LIKE.html
ASKER
Upsss my mistake, wrong group.
This question is not about ms VB.net
But about MS Access
This question is not about ms VB.net
But about MS Access
Give me a minute and I will post the answer
I think it's this that you want!
Dim dbGrupo As Recordset
Dim db As Variant
Dim SQL As String
Set db = CurrentDb
SQL = "SELECT * FROM mytable WHERE ID = " & InputBox("my messa")
Set dbGrupo = db.OpenRecordset(SQL)
With dbGrupo
.Delete
End With
dbGrupo.Close
Dim dbGrupo As Recordset
Dim db As Variant
Dim SQL As String
Set db = CurrentDb
SQL = "SELECT * FROM mytable WHERE ID = " & InputBox("my messa")
Set dbGrupo = db.OpenRecordset(SQL)
With dbGrupo
.Delete
End With
dbGrupo.Close
You can refer to any field in the form's underlying recordset like this:
Forms("NameOfYourForm")!So meField
or, if you're running the code on the form, just use Me:
Me!SomeField
Note the ( ! ) operator ...
Forms("NameOfYourForm")!So
or, if you're running the code on the form, just use Me:
Me!SomeField
Note the ( ! ) operator ...
ASKER
LSMConsulting:
Yes I know that i can access any filed i that way.
But i need something else.
I have for example :
SELECT someID, someName FROM someTable
And i save it as my query: Query1
Than I create new Form1 based on that Query1
Access automagically :) creates text fields:
someID, someName
and lables someID, someName
I can access id for example: Me!someID.Value
But I need to remove field someID from Form1(I dont want to see it in my Form1)
(but remeber that my Form1 is still based on Quer1 so I should be able to access someID for current displayed record)
How to do this.
Yes I know that i can access any filed i that way.
But i need something else.
I have for example :
SELECT someID, someName FROM someTable
And i save it as my query: Query1
Than I create new Form1 based on that Query1
Access automagically :) creates text fields:
someID, someName
and lables someID, someName
I can access id for example: Me!someID.Value
But I need to remove field someID from Form1(I dont want to see it in my Form1)
(but remeber that my Form1 is still based on Quer1 so I should be able to access someID for current displayed record)
How to do this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
LSMConsulting great but I know how to remove it. But than i cant access it data!!!