Solved

Autopopulating Fields

Posted on 2004-09-22
9
336 Views
Last Modified: 2008-03-03
I'm unsure if I'm going about this the right way.  I'm creating a tracking database for our returned mail.  There is a three step process for each 'batch'.  Log, Assign, Completed.  I have one form specifically for just logging the batches into the database.  I have another form for changing the Assign and Completed information but neither of these steps can be completed unless there is a logged date.  What I would like is when the batch number is typed in that the logged date will auto-populate.  Any suggestions?
0
Comment
Question by:lizzy121202
  • 4
  • 4
9 Comments
 
LVL 10

Expert Comment

by:perkc
ID: 12127016
Change the table design for the logged date. Add a default value of the following:

=Date()

or if you also want the time:

=Now()

perkc
0
 
LVL 10

Expert Comment

by:perkc
ID: 12127022
Let me know if you need more clarification.
0
 

Author Comment

by:lizzy121202
ID: 12127110
Ummm sorry I didn't specify.  I need it to pull the assigned date off the table.  By time it has gone to the second form, it's all ready been logged into the database and thus has a logged date.  When I pull the second form and enter the batch number, I need it to tell me what the logged date is.  
0
 
LVL 10

Expert Comment

by:perkc
ID: 12127393
How are you populating the form? How are you entering the batch number?

Is the form bound to a table or query?

I would probably use a form/subform for this. The main form would have either a textbox or combo-box for the user to enter the batch number, a 'search button', and a subform with the visible property set to 'No'.

When the 'search button' is click I would use a dlookup statement or a recordset to determine if the batch number can be found in the table. If not, display a 'not found' message, requery the subform and make the subform visible.

The subform would have a query for the recordsource using the main form's batch number text/combobox as the critieria.

However, if you already have something else that works just clarify my questions and I'll post another option.

perkc
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 39

Assisted Solution

by:stevbe
stevbe earned 250 total points
ID: 12128585
in the after_update event of the BAtch Number control ... I am guessing combobox so they can choose batches that have already been entered ... this code assumes that BatchID field is a numeric data type, if it is  a text datatype (in the field's defiunition in your table) then use example 2.

BatchID is a numeric field
Private Sub cboBatchID_AfterUpdate()
    Me.txtBatchDate.Value = DLookup("AssignedDate", "MyTableName", "BatchID=" & me.cboBatchID.Value)
End Sub


BatchID is a text field
Private Sub cboBatchID_AfterUpdate()
    Me.txtBatchDate.Value = DLookup("AssignedDate", "MyTableName", "BatchID='" & me.cboBatchID.Value & "'")
End Sub


Steve
0
 

Author Comment

by:lizzy121202
ID: 12132950
The batch number can either be manually entered or scanned in, it will most likely be done by scanner.  We have a product called WASP, it's a bar code scanner with a point click interface.  Wherever the curser is when the barcode is read is where the number will appear.  

The form is bound to table, here are my fields.

BatchNumber       Number   *Primary Key
LogDateTime       Date/Time
Logged               Yes/No
AssignRep
0
 

Author Comment

by:lizzy121202
ID: 12133006
Errr...Sorry.
The batch number can either be manually entered or scanned in, it will most likely be done by scanner.  We have a product called WASP, it's a bar code scanner with a point click interface.  Wherever the curser is when the barcode is read is where the number will appear.  

The form is bound to table, here are my fields.

BatchNumber                  Number   *Primary Key
LogDateTime                  Date/Time
Logged                          Yes/No
AssignRep                      Text
AssignDateTime              Date/Time
Assign                           Yes/No
CompletedBy                  Text
CompletedDateTime        Date/Time
Completed                     Yes/No

Currently I have one form that is just for entering the batches into invetory.  I have a second form that is for changing the records.  What I would like is that once the batch number is entered, the logged date autopopulates.  I need this because it will be used as a validation that the records is ready to be assigned out.  It will also be used to determine the service level of the returned mail.  

I've tried using a subform, but I'm not sure how to use them correctly.  I've  created it both ways with these fields as the main form:

AssignRep                      Text
AssignDateTime              Date/Time
Assign                           Yes/No
CompletedBy                  Text
CompletedDateTime        Date/Time
Completed                     Yes/No

and these fields as the subform:

BatchNumber                  Number   *Primary Key
LogDateTime                  Date/Time
Logged                          Yes/No

and vs. versa.  If it would help, I can send you the database.  I'm a self taught Access DB user, so not knowing all the ins and outs, i tend to make things more complicated.  

Thanks
Liz
0
 

Author Comment

by:lizzy121202
ID: 12133157
Steve:

If the box is just a numeric text box, would I just drop the cbo at the beginning of the code?  

Me.txtBatchNumber.Value = DLookup("LogDateTime", "BatchTracking" , "BatchNumber=" & me.BatchNumber.Value)

Would this work?  

Liz
0
 
LVL 10

Accepted Solution

by:
perkc earned 250 total points
ID: 12133517
Try:

Me.txtLogDateTime = Dlookup("LogDateTime","BatchTracking","BatchNumber=" & Me.BatchNumber.Value)

perkc
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now