Excel VBA access database communcation

DanSMT

Board Regular
Joined
Sep 13, 2019
Messages
203
Office Version
  1. 2013
Platform
  1. Windows
Is it possible to select and item via Excel VBA from an access database list (cell with multiple item selection options)

1663100627787.png


My intent would be to select one of the two options from the field in access via excel vba. I am trying to build an interface that will select the option for a user when click a button.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Current code as follows;

VBA Code:
Dim cnn2 As ADODB.Connection 'dim the ADO collection class
Dim rst As ADODB.Recordset 'dim the ADO recordset class
Dim dbPath1 As String
Dim x As Long, j As Long
dbPath1 = "C:\Users\dans\NEW RGA UI\Targets\RGA.accdb"
Set cnn2 = New ADODB.Connection ' Initialise the collection class variable
cnn2.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & dbPath1
Set rst = New ADODB.Recordset 'assign memory to the recordset
rst.Open Source:="RGA", ActiveConnection:=cnn2, _
CursorType:=adOpenDynamic, LockType:=adLockOptimistic, _
Options:=adCmdTable
With rst
.AddNew
    .Fields("RGA Manual #") = TBrga
    .Fields("Date issued") = TBdoc
    .Fields("Open/Close") = 1 'this is the open close section that I am trying to figure out
    .Fields("Customer") = CBcn
    .Fields("Customer Contact").Value = TBcc
    .Fields("Customer PO #").Value = TBcpo
    .Update
End With
rst.Close
cnn2.Close
Set rst = Nothing
Set cnn2 = Nothing
On Error GoTo 0
Application.ScreenUpdating = True
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top