Fill many fields in a form with same information

nofar

Registered User.
Local time
Yesterday, 22:27
Joined
Jun 8, 2011
Messages
14
Hi,

I have a form that the users have to fill but the problem is that sometimes they have to fill the same information for many serial numbers for example:
the computers with the serial number 100 to 200 have the same product model, inspection date, etc.
Is there an easy way to do the data entry in this form?

Can i have a code that say for the serial numbers from A to B fill the other fields with the same information?

Do not hesitate to ask for clearer explication

Thx a lot for your help it will be really appreciated.
 
You could prbably just put something in the afterupdate event of the serial number text box - as in
Code:
if cint(left(textbox.value),3) between 100 and 200 then
otherbox1.value="....."
otherbox2.value="....."
Endif
 
You could prbably just put something in the afterupdate event of the serial number text box - as in
Code:
if cint(left(textbox.value),3) between 100 and 200 then
otherbox1.value="....."
otherbox2.value="....."
Endif

Maybe I didn't explain well but in my form:

for the serial number I need to enter 2 fileds for exemple 100 and 200, and the rest of the information and I want that form to save in my table a 100 records with the same information except for the serial number that change , Ex: 100, 101 102 103...200 but with the same information for all these serial numbers.
 
Then you would have to do something like the following.

Note: I don't really recommend approaches like this because it's kind of a kludge and if your users aren't careful you could end up with a lot of invalid data in your table. Also, it's only going to work if your serial numbers are always numeric and sequential. Use at your own risk.

Anyway, given a form with unbound controls for the beginning and ending serial number sequence, as well as controls for the other default values, you could add a command button with code like the following;

Code:
Dim lngStart As Long
Dim lngEnd As Long
Dim lngRecords As Long
Dim strSQL As String
Dim strMsg As String
 
lngStart = Me.txtStartSeq
lngEnd = Me.txtEndSeq
lngRecords = lngEnd - lngStart
 
strMsg = "You are about to add " & lngRecords & " to the Computers table." & vbCrLf
strMsg = strMsg & "Do you want to continue?"
 
If MsgBox(strMsg, vbYesNo + vbExclamation, "Add New Records") = vbYes Then
    Do While lngStart <= lngEnd
    
        strSQL = "Insert Into tblComputers(SerNo, ProductModel, InspectionDate) " _
       & "values (" & lngStart & ", """ & Me.txtModel & """, #" _
       & Me.txtInspectionDate & "#)"
       
        CurrentDb.Execute strSQL, dbFailOnError
        lngStart = lngStart + 1

    Loop
End If
 

Users who are viewing this thread

Back
Top Bottom