Save, Refresh form?

PhysicsGirl

New member
Local time
Today, 17:15
Joined
Jun 9, 2014
Messages
7
Hi there! I'll try to detail my goal and where I'm at, followed by my questions.

I'm really new to Access so pardon me if I'm slow on the uptake! I am trying to build a form that ideally will be used to collect demographic information from attendees at an event. In a perfect world, I would have one representative from each attending group (1-10 people, most likely) enter in the information related to: age, sex, ethnicity, city of residence, and a few other questions. There needs to be a record for each individual in the group, even though one person is entering the information.

1) Would it be possible to create a first page for the person entering their personal information, on which they can enter the number of people in the rest of their group? This would then hopefully generate the exact number of spaces for them to fill in their answers for the remainder of their party.

2) I am using a "Modal Dialog" form. What code (and how do I enter it) should be used to save the current record and refresh the page, allowing the next group leader to step up to enter the information?

I would be very happy to achieve #2 first, as I could easily instruct attendees to just submit and refresh the form for each person they are entering, if worst comes to worst.

Thank you so much for your time and help!
 
You can just click on the table and click on Form in Access' create tab.

This should generate a form that traverses through your records in the table. To create a new record click the arrow with a star on it.

To edit values, click the arrows to traverse to the needed record.
 
BlueIshDan,

My problem is that I will have many attendees filling this out and I do not want them to mess around with the database itself.

I don't have enough posts on the forum to be able to link you to the image of what I have so far, unfortunately.

What I need right now is to make the "Save and Refresh" button, which was just an edited "Ok" button, do what it's supposed to do (save their record and refresh the form so that the next attendee can enter their information).
 
I'd also like to make the "Cancel" button simply refresh the form, and not actually close the Modal window that appears.
 
I'm sorry, but you'll have to plainly explain to me what your rules and procedures are. :)
I'm guessing

User fills out an array of questions.
User presses submit.

Clears interface and allows another user to fill out the list of questions.
 
User fills out an array of questions.
User presses submit.

Clears interface and allows another user to fill out the list of questions.

Exactly! This is assuming I can't do something more sophisticated like adding multiple pages or a responsive questionnaire which populates based on the result of one question (e.g., "How many attendees are in your group?" "4" the form generates four sets of questions while generating a unique ID for each set).

I do already have the form built.
 
Then are you just looking to know how to generate an insert query as dynamic as your form is and run it on the submit button click event?
 
Forgive me, I'm still very very new to access. What do you mean by "an insert query"?
 
Study those a bit.
You can reply here, or private message me, if you would like any guidance on how to apply these Queries to your tables. :)
 
Hmm.. That's still not what I'm doing.

This is the link (fix the space) to an image of what I currently have going on. i.imgur com/JT98ULw.png
 
Your save and refresh button is going to have to at some point and time. Insert that information into the database. Whether you want to do it by vba or running a query.
I'm guessing the query will be easier since, from what I can tell (sorry if I'm wrong), you don't have an extensive knowledge in vba.
 
I had previously been using the Property Sheet of the Command button (which my "save and refresh" command button is "command1"). Under the "On Click" event protocol, it opens into a Visual Basic window where I can edit the code. Shouldn't there be a simple way to tell it, using this code, what to do on click of the button?
 
Sure lol

Code:
    Dim rs As Recordset: Set rs = CurrentDb.OpenRecordset("[table_name_here]")
    
    rs.AddNew
    
    ' Do this line fo reach of your selected values.
    
    rs!FieldName = Control.value
    
    rs.Update
    rs.Close
    
    ' If you want to close the form
    DoCmd.Close
    
    ' If you want to clear the form
    
    ' RadioButton: All of them
    radControl.value = CInt(False)
    
    ' Text Box:
    txtControl.value = vbNullString
    
    ' ListBox: ComboBox:
    lstControl.RowSource = vbNullString
    cboControl.RowSource = vbNullString
 
I had previously been using the Property Sheet of the Command button (which my "save and refresh" command button is "command1"). Under the "On Click" event protocol, it opens into a Visual Basic window where I can edit the code. Shouldn't there be a simple way to tell it, using this code, what to do on click of the button?

Command1 Is not a good name. Try CmdSave. Much more descriptive.

If you move away from a record that has not yet been saved then it will save automatically.

Or you could use this code to save a record.
Me.Dirty = False
Just put it behind a command button.

Do you really need your form to be Modal. Just until you get a little more experience keep things as simple as possible and just accept the default when offered to you.

Hope this helps a little.
 

Users who are viewing this thread

Back
Top Bottom