• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

Accessing current recod data form VB


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("someID");

Best Regards
  • 3
  • 3
  • 2
1 Solution
Jorge PaulinoIT Pro/DeveloperCommented:
f_o_o_k_yAuthor Commented:
Upsss my mistake, wrong group.
This question is not about ms VB.net

But about MS Access
Jorge PaulinoIT Pro/DeveloperCommented:
Give me a minute and I will post the answer
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Jorge PaulinoIT Pro/DeveloperCommented:
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
End With

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You can refer to any field in the form's underlying recordset like this:


or, if you're running the code on the form, just use Me:


Note the ( ! ) operator ...

f_o_o_k_yAuthor Commented:

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.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Either (a) remove it from the form, or (b) make the control invisible. To remove it, open the form in Design view, highlight the control and press the Delete key. To make it invisible, highlight the control and set the Visible property of the control to False.
f_o_o_k_yAuthor Commented:
LSMConsulting great but I know how to remove it. But than i cant access it data!!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now