Solved Filling out the form from the xls file (1 Viewer)

pjo3us

New member
Local time
Today, 14:13
Joined
Dec 13, 2022
Messages
3
hello Everyone
I have a problem how to set the selected value from the xls file to a certain field of the form. The problem is that the values in the table connected to the form are declared as numbers, and the data that is pulled from the xls file is a string. The error would be solved if you just changed the declared values of the table into a short text, but that is not an option for me at the moment, because the existing table is already quite large and it would be bad to damage it.
Before entering the fields of the form, I have the condition of checking if such data already exists in the table, if not, to enter it. That option works, but as soon as you need to set that value in the form field, an error appears.
I also have an example of my problem in the attachment, so if I was a little unreasonable, you can better understand the problem through an example :)

sl1.png
 

Attachments

  • DemoXls.zip
    99.2 KB · Views: 56

Gasman

Enthusiastic Amateur
Local time
Today, 13:13
Joined
Sep 21, 2011
Messages
14,320
Convert using VAL() ?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:13
Joined
May 7, 2009
Messages
19,248
you try this and see the code behind cmbInportXls.
you also need to Relink your excel file.

Note all your Combobox, Bound Column property is Set to 1 (which is the First field of your tables, autonumber field).
therefore you need to assign a number to the comboboxes, not the string (car name or color name).
 

Attachments

  • demoXls.accdb
    1 MB · Views: 50

bob fitz

AWF VIP
Local time
Today, 13:13
Joined
May 23, 2011
Messages
4,727
hello Everyone
I have a problem how to set the selected value from the xls file to a certain field of the form. The problem is that the values in the table connected to the form are declared as numbers, and the data that is pulled from the xls file is a string. The error would be solved if you just changed the declared values of the table into a short text, but that is not an option for me at the moment, because the existing table is already quite large and it would be bad to damage it.
Before entering the fields of the form, I have the condition of checking if such data already exists in the table, if not, to enter it. That option works, but as soon as you need to set that value in the form field, an error appears.
I also have an example of my problem in the attachment, so if I was a little unreasonable, you can better understand the problem through an example :)

View attachment 106989
I have no understanding of what your db is for or what you are trying to do, but:

Your code errors on the line of code:
Me.cmbModel = Model
because "Me.cmbModel" requires a numeric value but "Model" is a string
Try this:
Change the declaration of Model to Integer
Change Model = Me.cmbInportXls.Column(1) to Model = Me.cmbInportXls.Column(0)
 

Users who are viewing this thread

Top Bottom