View Full Version : Update access textbox from VB.net


desmond
03-24-2010, 10:19 PM
Does anyone know how to update a textbox value on an Access form from VB.NET?

Dim oAccess As New Access.Application
oAccess.OpenCurrentDatabase(filepath:="C:\TestDB.accde", Exclusive:=True)
oAccess.Visible = False
oAccess.DoCmd.OpenForm(FormName:="Main_Form", View:=Access.AcFormView.acNormal)

I want to be able to update the textbox, then click a form button from VB.NET without oAccess.visible = true.

Can anyone help????!!!

ripp3r
08-04-2010, 12:14 PM
Does anyone know how to update a textbox value on an Access form from VB.NET?

Dim oAccess As New Access.Application
oAccess.OpenCurrentDatabase(filepath:="C:\TestDB.accde", Exclusive:=True)
oAccess.Visible = False
oAccess.DoCmd.OpenForm(FormName:="Main_Form", View:=Access.AcFormView.acNormal)

I want to be able to update the textbox, then click a form button from VB.NET without oAccess.visible = true.

Can anyone help????!!!

This doesn't help?


MyTextBox.text = "The new text"

SOS
08-04-2010, 12:35 PM
You need more automation objects sort of like this (I've not gone this route before so can't guarantee 100% accuracy):

Dim oAccess As New Access.Application
Dim acFrm As New Access.Form

oAccess.OpenCurrentDatabase(filepath:="C:\TestDB.a ccde", Exclusive:=True)
oAccess.Visible = False
Set acFrm = oAccess.Forms("Main_Form")
acFrm.Controls("YourTextBoxNameHere").Value = "Whatever"
Call acFrm.YourCommandButtonNameHere_Click()



(that is AIR CODE - untested)