Problem writing to a combobox

Mike Tomkinson 21 Reputation points
2020-10-30T10:41:31.52+00:00

I am sure this is a very basic lack of thought/knowledge on my part. It's a long time since I did any code.
So here goes.
I'm recording data about my ancestors
I have a single user database with one main table and 4 other tables, one of which is called "Concerns" and is a 2 column table with autoID numbers and short names e.g. 10,WilliamT-2.
The main table has a form which has various boxes including a combo box which refers to "Concerns".
I have now started recording ledger entries from 1837-1850 and the Concerns field will be the same in all of them ( No 10,Wm2). So if there is a page reference in the box "Ledger page", I would like, inter alia, to set the Concerns box to 10 programmatically without having to do it myself for the next several hundred records.

Herewith my simple code, which will set a value in an ordinary text box, but will not set it for "Concerns" giving error 3032

Private Sub Ledger_page_Exit(Cancel As Integer)
Concerns.SetFocus
If Ledger_page.Value <> 0 Then Let Concerns.Value = 10 Else Let Concerns.value=Null

End Sub

I can't find the solution after several hours- so I have to ask! No doubt I have omitted something vital.

thanks

Mike

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,044 questions
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 30,346 Reputation points Microsoft Vendor
    2020-11-04T06:26:28.51+00:00

    Hi @Mike Tomkinson ,

    Thank you for sharing screenshots and detailed information with us.

    It seems this issue is more related to Access and maybe VBA(not very sure). As you know, our forum is about the usage of tools and editors in Visual Studio, and Access and VBA are currently not supported in the Microsoft Q&A forums, the supported products are listed over here: https://learn.microsoft.com/en-us/answers/products/ (more to be added later on).

    As RLWA32 recommended, you can start a new thread in Access for Developers Forum. And for VBA, you can post this issue here: MSDN Visual Basic for Applications(VBA), and get more professional help.

    Thank you for your understanding.

    Sincerely,
    Tianyu

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Mike Tomkinson 21 Reputation points
    2020-11-02T12:35:00.617+00:00

    Hi @Tianyu Sun-MSFT
    Thanks for responding
    Sorry- for some reason I left out that I was working in Access VB

    The table structures are as follows:

    Concerning: ID Autonumber, Firm (short text)
    Itembasic- main table
    36871-image.png

    Associated form: Item1
    36827-image.png
    and in design view focused on "concerning"
    36853-image.png
    ·
    Si I am trying to set the value of Concerns to numeric 10- corresponding to Wm2, firstly in the form and thence into the table itembasic. I am not trying to add a record. That way when I go back to the record in the form, it will show up as WilliamT-2. However, I can't make it work, probably because the datasouce is from the table "Concerning" and not set to receive anything else.

    Hope this is clear- please ask if you need more info

    Thanks

    Mike

    0 comments No comments

  2. Mike Tomkinson 21 Reputation points
    2020-11-02T15:37:18.223+00:00

    I see I was not informative enough.
    What I have tried to do is that if the item has an entry in the box Ledgerpage, then on exit from that box, the value 10 is written to the box Concerns. If of course the value in Ledgerpage is removed- or set to zero, then the value in Concerns should be Null.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.