How to open Form with selected names for editting (1 Viewer)

captgnvr

EAGER LEARNER
Local time
Today, 12:56
Joined
Apr 27, 2010
Messages
144
D/Sirs

All going good and now I am on to a bit of lipstick job and sprucing up on presentation.

At present I have a separate form to select a staff and do the editing of all the data.

Would be nice if I can get help for the following:

I have this multiselect listbox. Is there a way to do editing of about 10 fields for say 5 names selected from the multiselect listbox in a new form or an existing form for this purpose? So that on a regular basis names can be selected and data corrected quickly.

I am even thinking of two selections - like one multiselect for the names and another multiselect to select the fields that needs to be edited.

Pls help.

brgds/captgnvr
 

DCrake

Remembered
Local time
Today, 08:26
Joined
Jun 8, 2005
Messages
8,632
Don't run before you can walk. Get what you want to do for one record, then when tested simply put the actions on a loop based on the selected items in your listbox changing the PK on each loop.
 

captgnvr

EAGER LEARNER
Local time
Today, 12:56
Joined
Apr 27, 2010
Messages
144
D/David

:). Not my fault, this forum help is so much that it makes one run before they could walk.

Actually I have already tested the edit form which is too novice. Select a name from the combo box and it displays all the fields for that person and I carry out the editing.

I got the idea from one of the help from my earlier threads where I use the multiselect and get to display the query with required fields. In that query itself I could change the particulars of the staff. So thought if I could get this data to be opened in a form then I can control the data entry using input mask and validation rules. So pls help me run:).
 

DCrake

Remembered
Local time
Today, 08:26
Joined
Jun 8, 2005
Messages
8,632
Give me an example of the type of thing you want to bulk update?
 

captgnvr

EAGER LEARNER
Local time
Today, 12:56
Joined
Apr 27, 2010
Messages
144
D/David

I will make a short example.

1. charlie, romeo, smith selected from multiselect.

2. to modify data fields like contract-date, join-date, contract-period. Some times some other fields might require to be modified.

I have a solved query (thanks to this forum) which opens on selecting the names from multiselect. I want to develop it further by using this query to open a designated form with the fields selected for changing the data.

Wont it be nice to have another listbox with multiselect to pick the fields for modifying?

Thank you for such a quick response.
 

DCrake

Remembered
Local time
Today, 08:26
Joined
Jun 8, 2005
Messages
8,632
Combo boxes come with the factility to choose Field list, however this is not adviseable as it is not very user friendly as the names may not mean anything to the end user.

In you combo change the rowsource to Value list and provide the list as such

"Contract Date","[ContractDate],"Start Date","[StartDate]","Etc","Etc"

Set column count to 2
Set column 2 as bound column

Then construct your sql according

Code:
Dim UpdSQL As String

UpdSQL = "Update Table Set " & MeCboFieldList & "= '" & UpdatedString &"' Where [PKField] In(" & SelectedItems & ")"

DoCmd.SetWarnings False
DoCmd.RunSQL UpdSQL
DoCmd.SetWarnings True
 

captgnvr

EAGER LEARNER
Local time
Today, 12:56
Joined
Apr 27, 2010
Messages
144
D/David

Thanks for the headstart. I will read up and try as guided. But this way I wont be able to pick and choose the fields that is required to be modified. For example if join-date and contract-period is updated next time I might need to change only the passport and seaman_book or all of the fields.
 

DCrake

Remembered
Local time
Today, 08:26
Joined
Jun 8, 2005
Messages
8,632
Each time you visit this form you can change the field selection to suit your needs. Still not quite clear what you are actually wanting to do. Can you provide a working example of what you would like to do on screen and what you would expect the code to do.
 

captgnvr

EAGER LEARNER
Local time
Today, 12:56
Joined
Apr 27, 2010
Messages
144
D/David

I am trying to make a small db and send. or I will word it better. I got some export cargo formalities and hence did not do immy. Thanks for ur post. In any case I want to use the combo box as u hv suggested. What I am unable to figure out is how I am going to select say five fields to update at one go? For example select three names from the list and carry out corrections of fields like joining-date, passport
and contract-period.
 

captgnvr

EAGER LEARNER
Local time
Today, 12:56
Joined
Apr 27, 2010
Messages
144
D/David

I am having difficulty in putting into words what is required.

Assume I have a table with staff names and their details in various fields like staff-code, birth-place, passport, and so on.

I do have a form to open all the data for a selected person and carry out editing.

Now I want to make it more user friendly so that it will give two multiselect listboxes.

ListboxA to select as many names as needed.

ListboxB to select fields needed for editing. For example if only 'passport' needs to updated or if more fields like staff-code, birth-place, passport, date-join to be updated.

With these two listbox selected particulars to appear in a new form or any allocated form so that it gives all the name selected and the fields selected like in a datasheet format or like excel sheet where I can go to for example staff-code and enter for all the selected people row by row and move to next field like date-join and enter for selected names. I am trying this out to make it more user friendly and quicker to update this way rather than what I have now for editing one name at a time.

Sorry if I am taking your time as bit bad in expressing it in English.

FYI, today and tomoro there is no export operations and will devote the full night to get this going. Your advice to use combo box I am unable to figure out how to multiselect say how to select if four of the fields for the selected persons need to be changed. Pls help.
 

captgnvr

EAGER LEARNER
Local time
Today, 12:56
Joined
Apr 27, 2010
Messages
144
Combo boxes come with the factility to choose Field ...
In you combo change the rowsource to Value list and provide the list as such

"Contract Date","[ContractDate],"Start Date","[StartDate]","Etc","Etc"

Then construct your sql according

Code:
Dim UpdSQL As String

UpdSQL = "Update Table Set " & MeCboFieldList & "= '" & UpdatedString &"' Where [PKField] In(" & SelectedItems & ")"

DoCmd.SetWarnings False
DoCmd.RunSQL UpdSQL
DoCmd.SetWarnings True

D/David
Got down to do as u hv suggested.

Feel delicate to ask for basic things. Like in the below code, I have not defined this 'updatedstring' and also '[pkfield]'.

UpdSQL = "Update Table Set " & cb_getInfo & "= '" & UpdatedString & "' Where [PKField] In(" & SelectedItems & ")"

Would be grateful if the above line of code can be explained.

I feel that it will not perform my requirement bcos I want to select certain fields whereas in this combo box only one filed at a time i can select.

Ideally, two multiselect listbox, one with names and other listbox with all the fields for the said record/person. After these two listboxes are selected a Command button to trigger code to display the selected names and the selected fields for editting/ammend data.
 

Users who are viewing this thread

Top Bottom