I created an ACF field for the user profile.
I want to insert data into an ACF Field on database level. I added two lines in the user_meta One for the group I want for the field. But on the user profile The field is empty.
Background: there is a value for every user from a separate system. I like to update every user with the specific value. My idea was to update the ACF on DB level.
I'm not sure I totally follow your situation, but by the sound of it, you are looking for...
update_field("field_name or field_id", "user_".$user_id);
Source
Related
I have a table [inventory] with inventory items, and a bunch of columns with different information for those. Mainly, part#, description, price. I am trying to create both a purchase order form [POForm] and, and a inventory transactions form [TransactionsForm], but that one thing I've been stuck on is getting a combo box look up I use to select the part# from [inventory], to also fill my fields for description, and price for that item in my form. I need the fields that are filled to be able to have formula's run off of them, and the information to be saved into the table for that form [TransactionsTable], [POTable].
I've tried making my part# combo box include the fields for the description and price, and using =[part#].[column](x) in the other fields as a lookup, and it looks right visually, but that is apparently just a visual of that data, but technically the field is still blank, because those other fields remain empty in the table for that form, and I am not able to run a formula off the price.
As per my understanding and please correct me if I am wrong. you have a form that shows your inventory data Part# Description & price. This form has a combo box that allows you to select a particular part # to view its related record data description and price.
Now you want to click a command button after selecting a particular part # to update your transaction form and POtable.
1.you have to create a query,
2.insert the inventory table in it
3.select append from the query type in the ms access ribbon
4.a window will appear, choose the transaction table as the destination table to append to.
5.double click on the fields that you want to retrieve its data from the inventory table
6.then in the table below in the query itself in the "append to" row you will find drop-down menu including all the fields from the transaction table. choose the corresponding fields. note if the fields have the same name in both tables access will do it automatically.
7.in the criteria row type the following [Forms]![Inventory Form Name]![the name of the field in the form]. do that for each field in the happen query.
8.save the query and name it
9.go-to design view in your inventory form and create a command button, in the click on event creat macro of the following: openquery-->type the append query name
10.save and close macro builder
11.open your form, select part#, click on the button
12.access will ask you to confirm appending process. click ok/yes
13.check your transaction table to confirm that the append process was successfully performed
14.Tip if you do not want the confirmation msg of append to appear, in the click on event go to the macro builder and choose in the ribbon show all actions then in the first line of the macro builder insert setwarnings - NO
the same is to be applied for the POtable.
Anyways, I hope you find this clear and helpful but I have only one concern you do not have to append part description and price in transaction and PO tables as you already have this data in your database in the inventory table. Generally speaking no need to include the same information in multiple tables otherwise you are not benefitting from the idea of a relational database.
I hope I addressed your inquiry.
I am trying to update product price values, directly from database. I tried with the first 3 lines values, and everything goes fine at database level. The problem is that new values do not refresh at the web application.
I already clear cache, and re-built the product's index. But nothing happens.
Any suggestion?
Thanks.
if u want to change price directly in database you have to change it in product table and also in product_shop table.
while working on my new application customers came back to me with specific requirement. They would like to prevent multiple users editing same record at the same time. For example if User 1 login the application, search for the record and then select the record. There is few different forms that shows the data for selected record. For example that can be demographic form, family info, etc. Let's say we have User 2 who logged in and selects the same record. In this situation we would like to prevent both of them editing any of the forms at the same time. I'm wondering if my approach is a good fit or there is something that would work better. What I do is next:
User selects the record, the automatically save this record in Lock table
Lock table has RecID (autoincrement field), UserID(unique id for each user in the system), SelectedID (Record that user selected) and DateTime (Timestamp)
Then I disable all Edit buttons in each form on the front end.
On the back end I join Lock table to every update query. For example:
<cfquery name="updateDemo" datasource="#dsn#">
Update dbo.Demographic
Set LastName = 'Kelly',
FirstName = 'Mike',
DOB = '07/06/1967'
From Demographic AS D
Left Outer Join dbo.Lock AS L
On L.SelectedID = D.SelectedID
Where RecID = '123132'
And L.UserID = Session.UserID
</cfquery>
In query above I join table that will be update to the Lock table SelectedID. That way only selected record is update and we are making sure that UserID in Lock table is matching Session User ID. Users can unlock the Selected Record any time by clicking unlock button in the system. I'm not sure if this method is the best. So far I can't find any issues but this code is still in development phase. If anyone have any suggestions please let me know. I use SQL 2008, ColdFusion 2016 with JQuery and Bootstrap 3 on the front end.
Your solution should work but it sounds a bit complicated. I would:
Add an updatedAt column to the Demographic table and update it
with getdate() on save.
Add the updatedAt field to your form and prefill it with the record data from the table.
When updating make sure that the updatedAt field in the table equals to the updatedAt field in the form data. Throw an error if the updatedAt
field in the table is newer than the updatedAt data in your form.
Here is how I have solved this in the past.
For information that will need this kind of 'locking' add a numeric column named something like 'version'.
Every time a row in this table is saved, increment the value of 'version' by 1.
Include this value in any form used to edit the table.
If user A pulls up a record at the same time as user B, but user B saves the information first, the 'version' will be different when User A submits their form.
On form submit, do a check that the 'version' passed in matches the 'version' from the DB. If it does...update the table,. If it doesn't redirect the user to the form and let them know they are not updating the most recent 'version' of the data and give them an option to load the updated data.
I have a form in my Access Database that is used for students to scan their badge and log in. If their badge hasn't been registered, the form just allows them to enter their information. I'm running into a problem where I'm using a Query that pulls their badge number from the previous form (which is inserted into a table temp) and compares it to the table with their information on it.
The problem I'm running into is that when I do this, I can't edit the information in the form, nor can I add more to entries, and when I separate the query and try to just pull from the table externally
(BadgeNumber = [temp]![T2])
it just pulls up a messagebox asking for the value.
Does anyone have any suggestions for accomplishing this?
I have the following situation:
I have a many to many relationship.
For example an Employee Table, an Course table, and an relation-table inbetween.
Now I want that the user can select out of the course table his courses in a dialog form.
That means that the underlying table for my continous form inside the dialog is the course table.
I want a checkbox in every row which indicates if the course is selected or not.
As I read it is not possible, to add an unbound checkbox, because they are just copies, and a select click would select all of them.
The solution would be to add an yes/no field to the underlying table courses.
But here I have the problem as I understand the matter, because I have several users using the database at the same time, that the underlying table will be updated if I click one checkbox and this update will select the value for all users which are using the dialog form concurrently, what I dont want.
So my question is, is there another solution to get a working checkbox per row in a multi user access database.
There are two solutions which I could imagine:
1) The underlying table will be the relation table and in this every possible combination between employee and course will be saved together with a yes/no field. (but that would be from a data view point quite horrible)
2) If the changes to a checkbox would not be directly written back to the database table, I could discard them on saving and manually insert the relation records in the relation table. (Is that possible?)
Thanks for any solution proposals
I see two good approaches:
1) This assumes that your database is split in a network backend + each user has a local frontend. This is the recommended setup for multi-user.
The frontend has a local table with Course_ID and a yes/no column.
A join of this local table with the Course table is the recordsource for your continuous form.
On loading, you copy the course ids into the local table, and set the existing relations to True.
On saving, you update the relation table.
2) Use a ListView control instead of a continuous form. It has inbuilt checkboxes. Loading and saving is done with a VBA loop.
Based on your description I assume your form has a LEFT/RIGHT JOIN in its data source where some ID field is null if the specific Course/Employee combination does not exists in your relation table. Let's call it LinkID. Then your checkbox should be something like =NOT ISNULL(LinkID). While you will not be able to use the OnClick event for the user to check/uncheck this way, you can use the onMouseDown event to see if the user clicked the checkbox and take action accordingly.
That way you don't need an "all combinations" relations table, no temporary table and no Yes/No field. If a record with the Course/Employee combination exists the box is checked, if it does not exists, it is not checked. Adding and removing courses is done by adding and deleting records from the relation table.
Have a look at this How to use unbound checkbox in a Continuous Subform - MS Access. A class that binds an unbound checkbox. Better than listbox, because you have a form with all its benefits (sort, filter, edit, append).