Button for Changing Field Values on one individual record

dcumming

New member
Local time
Today, 22:08
Joined
May 5, 2021
Messages
20
Hiya,

I've a form that I update manually when I buy stock - and I'd like to be able to automate it a bit.

For example, if I get a soundtrack on vinyl, i want to be able to update a number of the fields, rather than changing them individually.

In this example, I would update ebayRecordSize, eBayShopCat2, eBayGenre, eBayCountry
and then eBayTitle based on a combination of other fields

Any ideas how best i do this?
thanks
David





button for form.png
 
without knowing your table structure, relationships and all the potential variations for updating, can only point you in a couple of directions

1. have a table to specify the variations then use vba to either use dlookup or a recordset to get this data and populate the other fields

2. use vba to return the first record that matches your combination of other fields and populate the other fields - and do nothing if it doesn't find one


method 2 will be more dynamic and probably easier to maintain
 
It's hard to know what you mean. If you view a record on screen, you should be able to edit the record to make changes.

How would you expect a new record to automatically describe itself?

If you are saying that some of your fields are actually dependent on other fields, then that probably points to errors in the table design.
 
Hi Gemma et al - seems I've rushed the explanation of what I'm trying to do.

I just want to be able to click a button and update a number of fields in an individual record, rather than having to fill them in manually

No fields dependent on others - they are dependent on the vinyl or CD i have in my hand

I get a lot of soundtracks from USA, i would like a button that updates the fields to certain values, rather than me doing it manually.

ie update the eBayCountry field value to "United States", the eBaygenre field to "Soundtracks & Musicals", the eBayShopCat field to 43633312011, and then to add the value - ([Title] &" "& "Soundtrack Vinyl Record New" & " "&[Barcode]) to the eBayTitle field.

Each time i get a soundtrack vinyl/CD i'm having to do this manually

Hope this makes more sense
 
How are you meant to know which is which?

I would perhaps have a table that holds all that information, all the variations that you can have.
In a form you would select the particular version you want today and press a button.
That would add the record with your set defaults, and then open to that record on your form that you use for editing. You could even have a control for the number of times a record is added.

Another way would be to locate a similar record and suplicate that data.

I believe you are confusing us as you are saying Update, which infers updating a certain record?, which one?

Does that sound feasible?
 
"How are you meant to know which is which?" - not sure what you mean

I just want to press a button and make those changes to the record that is currently on screen - there will always be some manual entry from me, the name of the artist for example.

i want to update the record that is currently on screen in the form.

the process is this:

i get a CD from a supplier
i enter the artist name and title into the relevant fields on the form
Because it's a CD, soundtrack from USA - i want to click a button to update those fields. (Simplistic version - there are a number of fields i want to update)

that's it - thats all i want to do.

I could have a button that creates a new record with that information, but to be honest it's much of a muchness - I'm clicking a button to ensure a record has certain fields populated with information i want.

This is the form when i create a new record. Certain fields are auto populated - i mainly sell new vinyl from the UK

1724676183531.png
 
"How are you meant to know which is which?" - not sure what you mean
I am asking 'How are you meant to know what goes in what controls on your form, just by having something in your hand' :(

What if if you have Tusk by Fleetwood Mac on LP. What values are then going to go into those controls.
If you want to update instead of appending, then it still begs the question, what values are meant to go into those controls?

When you do it manually, YOU know what those values are.?
How are you meant to find those exact values to populate the controls?, be it an update or an append?

What would the value of ebayshopcat2 be for the above Tusk album?
 
I will liken it to ripping a CD.
I buy a CD and put it in my laptop to rip it.
The program goes online, and finds the tracks, genre etc.
I might alter something for my preference, then rip it.

Now and again, the CD is not found, so I manually enter all the details, and submit the data so that others who buy the CD can get the data automatically.

My point being, that the program has to know where to get that data, to complete the control values.
So where are you expecting this data, that you automatically want to populate the record with, from?
 
So to clarify- you want a button that when clicked updates specific fields in the current record with pre programmed values.

So button caption might be eBay-USA-vinyl

Whilst another button might be eBay-UK-CD-rock

if so the code behind the button click event might be something like

txtSource=“ebay”
txtcountry=“USA”
Etc

Or if property normalised

cboSource=3
Etc
 
So to clarify- you want a button that when clicked updates specific fields in the current record with pre programmed values.

So button caption might be eBay-USA-vinyl

Whilst another button might be eBay-UK-CD-rock
Yes!

"@CJ_London
if so the code behind the button click event might be something like
txtSource=“ebay”
txtcountry=“USA”

Etc"
Something like this yes

i was hoping there would be an onclick command

'For this record'
UpdateField eBayCountry = "United States"
UpdateField eBayGenre = "Soundtrack"
 
Try my suggestion- you’ll need to provide your field names if you are going to update the field rather than the bound control. And you’ll need to late bind I.e. me!ebaycountry
 
I just want to be able to click a button and update a number of fields in an individual record, rather than having to fill them in manually
As the others have pointed out, there is no magic to this. YOU must define the values. If what you are talking about is defaults, then you can set defaults on a table field. So, if you leave eBayCountry empty, it defaults to "United States".
 
Hiya,

I've a form that I update manually when I buy stock - and I'd like to be able to automate it a bit.

For example, if I get a soundtrack on vinyl, i want to be able to update a number of the fields, rather than changing them individually.

In this example, I would update ebayRecordSize, eBayShopCat2, eBayGenre, eBayCountry
and then eBayTitle based on a combination of other fields

Any ideas how best i do this?
thanks
David





View attachment 115805
  1. Create a command button and name it UpdateEBay. Caption is Update E-Bay
  2. Go to the button Events tab
  3. Using the On Click Event, add any event you wish, such as:
  • Me.ebayrecordsize="12'"
  • Me.ebaygenere="Soundtracks & Musicals"
  • Me.ebayShopCat1=18
  • ebaycountry="United States"
 
  1. Create a command button and name it UpdateEBay. Caption is Update E-Bay
  2. Go to the button Events tab
  3. Using the On Click Event, add any event you wish, such as:
  • Me.ebayrecordsize="12'"
  • Me.ebaygenere="Soundtracks & Musicals"
  • Me.ebayShopCat1=18
  • ebaycountry="United States"
AND THIS IS THE ANSWER!!!!!!

"I just want to be able to click a button and update a number of fields in an individual record, rather than having to fill them in manually"

thankyou @LarryE for reading my request :)
 
so the same suggestion made in post #9 didn't work for you?
 
OK - not quite sure what you see as being different

given it is guesswork to what your actual fields are called (can't rely on a label caption), only difference between

txtSource=“ebay”

and

Me.ebaygenere="Soundtracks & Musicals"

is the Me. - which is the default and does not need to be used unless you want intellisense
 
"I just want to be able to click a button and update a number of fields in an individual record, rather than having to fill them in manually"

Since you don't know how to code, I'm surprised you didn't like my no-code solution of defining defaults which is the normal method of doing this. I hope you have set these fields to required or have proper validation code because if you forget to press the button, you will be saving invalid records. That wouldn't happen if you had set defaults at the table level.

PS. Experts don't write code when property settings will solve a problem.
 

Users who are viewing this thread

Back
Top Bottom