473,386 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Using a Combo-Box with Data Entry Form

4
I have a data entry form that uses a control button to process multiple "samples" using

Expand|Select|Wrap|Line Numbers
  1. Private Sub GenerateRecords_Click()
  2. Dim mn As Long
  3. Dim Rec As Long
  4.  
  5. Rec = (Me.Text2 - Text1) + 1
  6.  
  7. For mn = 1 To CInt(Rec)
  8.   DoCmd.GoToRecord , , acNewRec
  9.   Me.VoucherNo = Me.AutoDate + mn
  10.  
  11. Next mn
  12.  
  13. End Sub
In the form I have a Combo Box that selects a field value I would like applied to all the multiple entries. Currently only the first entry retains the combo box information.
Mar 10 '14 #1
4 3706
GKJR
108 64KB
Is this combo box in the Form Header/Footer, or is it in the Detail Section?
You say this is a data entry form, does that mean you want to apply a similar value to a field in all of the new records in the instance that the form is used?
Mar 10 '14 #2
jtmm
4
Is this combo box in the Form Header/Footer, or is it in the Detail Section? Have tried the ComboBox in both sections with the same results


You say this is a data entry form, does that mean you want to apply a similar value to a field in all of the new records in the instance that the form is used? Yes - When we create new samples we want the ComboBox value applied to all of them.

Thanks
Mar 10 '14 #3
GKJR
108 64KB
The problem you're having is because you can't use a control to represent the same field in multiple records. Controls on a bound form represent a single field in a single record. This is the reason you had the correct value in only the first record when you had the control in the header section.

As far as I know you will need to create a saved qry or SQL string that outputs all of the new records on your continuous data entry form. Even in a data entry form, each time you move into a new record, the previous record is committed to the table or record source it is based on. I can think of one way to do this, but it might not be perfect for your application. If you filter your query by Null values in the field to be updated automatically you would capture all of the relevant records, but you may also have other records in that table that have a Null value.

Once you have your query that captures only the records you want, try using the following. Make sure you change the values that I have in bold. It should be placed in the "On-Click" event of your button.

Expand|Select|Wrap|Line Numbers
  1. Dim db As Database
  2.     Set db = CurrentDb
  3. Dim rst As Recordset
  4.     Set rst = db.OpenRecordset("Your Query Name Here", dbOpenDynaset)
  5.  
  6. With rst
  7.     .MoveFirst
  8.     Do While Not .EOF
  9.         .Edit
  10.         !FieldToBeEdited = Me.ComboBoxNameHere
  11.         .Update
  12.         .MoveNext
  13.     Loop
  14. End With
If you filter by using the null values like I mentioned above, your query won't return any records after you click the button until you enter more records (presuming you selected a value in the combo-box).
Mar 10 '14 #4
zmbd
5,501 Expert Mod 4TB
jtmm:

Please review the following tutorials and concepts, especially the concept of normalization:

There are several links here:
------
Scan the titles here, there's everything from the very basic to the esoteric: Microsoft Access / VBA Insights Sitemap

Same with this site: Allen Browne's Access Tips

And when you get into subforms:
This is the most simple and sweet: Allen Browne: Referring to Controls on a Subform

THis is the reference I will use when I get lost:
Forms: Refer to Form and Subform properties and controls
I'm worried enough that this site might ever go down that I took advantage of the download offer of a hardcopy of the table - upper right hand corner!
--------------------------------

Once you have these basics for database and form design you'll find things much easier to accomplish.
Mar 11 '14 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Iain Miller | last post by:
Struggling a bit here & would be grateful for any help. I have a table which has a list of people in it. Each person has a unique ID automatically allocated by Access but also belongs to one of 5...
3
by: intl04 | last post by:
Is it possible to create a Word form as the data entry form for an Access database? I didn't see any reference to this possibility in my Access books, so I'm sorry if this is a question that is...
2
by: edworboys | last post by:
I have designed a data entry form with a number of fields and a sub form. The first field (Country) is a combo box and the user selects a country. This, in turn reduces the number of options in the...
1
by: Alex.Wisnoski | last post by:
I have a data entry form with a combo box to look up an entrant's name. If the name is already in the table then it pulls up the record and that part of the form works fine. If the name isn't in...
1
by: KC | last post by:
Hello, I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB. I have tweaked this DB to work for our small co. It has worked pretty well up until I made the mistake of deleting...
5
by: Aspnot | last post by:
Background: I have a data entry form that is bound to a DataSet. This DataSet contains 9 tables and the form displays data from each table in textboxes, not a DataGrid. One of the tables in the...
2
by: filbennett | last post by:
Hi Everyone, I'm generally unfamiliar with Access form design, but have programmed Cold Fusion applications for a couple of years. I'd like to build a data entry form in Access that allows the...
2
by: seltzer | last post by:
I am using Access 2000 but I also have the 2003 version. I am working on creating a data entry form in Access for a research study. Since there is a maximum of 255 fields per table in Access, I...
0
by: Tyler | last post by:
Made a data entry form which is a subform. I made a continuous form that displays everything entered through the data entry form. The data entry form displays all of the records. This doesn't...
1
by: Ville Mäkelä | last post by:
HI, In my data entry form with combo as well text boxes, I have a commad button which checks for any dublicate data using if clause and Dcount. If there is no dublicates, the data will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.