Select when update (1 Viewer)

Gismo

Registered User.
Local time
Today, 04:11
Joined
Jun 12, 2017
Messages
1,298
Hi all,

I have a 2 combo boxes where the user can select either the part number or the description
After the part number has been selected, the description must be updated
If the description has been selected, then the part number must be updated
But in the case where i do not have a part number nor description, it can be entered manually
When it was entered manually, I dont want any of the update queries to run

How would I accomplish this?
 

June7

AWF VIP
Local time
Yesterday, 17:11
Joined
Mar 9, 2014
Messages
5,463
Should not save both part number and description into record, just part number or the autonumber ID from Parts table.

If part number or description is not listed in combobox, then don't you want this added to the Parts table? Use combobox NotInList event to add new record to lookup table "on-the-fly" during data entry.
 

Gismo

Registered User.
Local time
Today, 04:11
Joined
Jun 12, 2017
Messages
1,298
So I have discovered that I was missing a link here
In the description dropdown displays the description and the part number, to be able to select the correct part
The update query then looks at the description then takes the first part in the material table then updates that part number instead of the one selected
How would I code the update query to look at the dropdown box selection for the description and the part number selected?

I dont have a reference to the part number selected
How do I look at the second field in the combo box to also take this in to account in the query?

1653634505432.png
 

June7

AWF VIP
Local time
Yesterday, 17:11
Joined
Mar 9, 2014
Messages
5,463
I don't understand what you are trying to accomplish. Why are you doing UPDATE query?
 

Gismo

Registered User.
Local time
Today, 04:11
Joined
Jun 12, 2017
Messages
1,298
I don't understand what you are trying to accomplish. Why are you doing UPDATE query?
After I have selected a part number, the description is updated in the temp file
or
After the description selection, the part number is updated

When I complete the transaction, the master file is updated without description

I only update the temp file with the description because I want to have to option to be able to select from description if they dont know the part number

I tried filtering by using below

1653635723313.png
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 02:11
Joined
Sep 21, 2011
Messages
14,221
So I have discovered that I was missing a link here
In the description dropdown displays the description and the part number, to be able to select the correct part
The update query then looks at the description then takes the first part in the material table then updates that part number instead of the one selected
How would I code the update query to look at the dropdown box selection for the description and the part number selected?

I dont have a reference to the part number selected
How do I look at the second field in the combo box to also take this in to account in the query?

View attachment 100815
Use the Column() property.
 

June7

AWF VIP
Local time
Yesterday, 17:11
Joined
Mar 9, 2014
Messages
5,463
Can have two comboboxes bound to same field. So only save PartNo - or whatever field is primary key for Parts table - with either combobox.

Side note: Description is a reserved word. Should avoid reserved words as names.
 
Last edited:

Gismo

Registered User.
Local time
Today, 04:11
Joined
Jun 12, 2017
Messages
1,298
Can have two comboboxes bound to same field. So only save PartNo - or whatever field is primary key for Parts table - with either combobox.

Side note: Description is a reserved word. Should avoid reserved words as names.
Ok, I will avaid using descripyion in the future

The query worked before but now after using Column I get the Undefined function
Any work araound?



Forms![DAW Sheet - Main]!Material.Form!Description.Column(1)

1653642360071.png
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:11
Joined
May 7, 2009
Messages
19,228
You cant use Column method of the combobox.
Add an unbound textbox (Visible = No) to your form. Add code to Description combo AfterUpdate event to set the value of the Unbound textbox:

Private sub description_afterupdate()
Me!txtUnbound=Me!description.column(1)
End sub

Now use the Unbound textbox to your Update query.
 

Gasman

Enthusiastic Amateur
Local time
Today, 02:11
Joined
Sep 21, 2011
Messages
14,221
You cant use Column method of the combobox.
Add an unbound textbox (Visible = No) to your form. Add code to Description combo AfterUpdate event to set the value of the Unbound textbox:

Private sub description_afterupdate()
Me!txtUnbound=Me!description.column(1)
End sub

Now use the Unbound textbox to your Update query.
Oops, sorry Gismo :(
 

Gismo

Registered User.
Local time
Today, 04:11
Joined
Jun 12, 2017
Messages
1,298
You cant use Column method of the combobox.
Add an unbound textbox (Visible = No) to your form. Add code to Description combo AfterUpdate event to set the value of the Unbound textbox:

Private sub description_afterupdate()
Me!txtUnbound=Me!description.column(1)
End sub

Now use the Unbound textbox to your Update query.
Works like a charm
Thank you
 

Users who are viewing this thread

Top Bottom