- Local time
- Today, 07:15
- Joined
- Jan 23, 2006
- Messages
- 15,549
Thanks!I envision that I enter a value, the list starts filtering (assuming there is one - I'm starting to lose track of what you have going on) and when I click or tab out of that field, DLookup looks for the value entered and since it won't be found (if there is list filtering going on and there are no records visible) the fact that the lookup returns no record is what triggers the prompt.
Research 'find as you type'
To learn how to prompt, research the message box function. The DLookup result (0) would be the trigger. The answer is passed back to the function and you do what you need to do based on the returned value of the function.
HI JDraw - Just so you know - I have made great use of the info from that link you've sent before! Thanks - That is exactly how I have had the control in question setup. And it works great - for me - but the other guys found it confusing because they'll be in the middle of a new inspection and there is already a coil number showing in the combo box - the first record in tblCoils. They want to see the coil number control be blank so they don't accidentally forget to put the coil number of the coil on the mill in that combo box. In other words - what COULD happen is that they both do a bunch of mill inspections and forget to put the new coil number in and we wind up with innumerable inspections all showing the same coil which happens to be the very first record in tblCoils.Tim,
Like Micron said "I'm starting to lose track of what you have going on ".
I have sent this link before, but I'm sending it again for you to review to see if it relevant to your current issue re "not in list".
I'd be happy too.Can you restate the steps for this inspection process? It seems that an inspector would have to confirm the coil number being inspected. If there is a list of coils, then when a coil is inspected, it would no longer be available. I'm just trying to see how the tblCoils is involved.
I worked in an area with a paint line so understand the overall process sort of. There are a number of coils; 1 is selected and mounted; it goes through the line; it is probably inspected at 1 or more stations as it goes through the line and a final inspection; that coil is dismounted and the process repeats.
Could you have an unbound text box that the inspector has to fill (your blank coil number)? Then compare whatever they have entered with another value.
I'm sure we can work this out once we understand the process and the "pieces involved". Sorry if it' just me who hasn't kept up with this.![]()
I'm just trying to see how the tblCoils is involved. I worked in an area with a
It is generated by the purchasing department when the coil is ordered from a supplier. The purchasing department creates a coil tag to be placed on the physical coil when it is received. The coil number is stored - at this point - in the company's large ERP system - -which again - is in no way and will never be connected to the QC database that I am developing. In other words - at this point - the QC database does not know the coil exists.Where does the new coil number come from?
How exactly does the inspector/person get and enter this new coil number?
Private Sub Text312_AfterUpdate() 'new textbox for CoilNumber
Dim tempCoilNo As String
'new coil number check
10 If Len(Me.Text312 & "") = 0 Then
20 MsgBox "You must enter a Coil Number", vbInfo
30 Me.Text312.SetFocus
40 End If
'check if coil is partial/has been used before
50 tempCoilNo = Me.Text312
60 If DCount("CoilNumber", "tblCoils", "CoilNumber ='" & tempCoilNo & "'") > 0 Then 'coil exists
70 Debug.Print " Coil " & tempCoilNo & " has been used previously. This is a partial coil"
80 Else 'brand new coil so add it to tblCoils
'CurrentDb.Execute Debug.Print "Insert into tblCoils (CoilNumber_pk,CoilNumber) Values (" _
& DMax("CoilNumber_PK", "tblCoils") + 1 & ",'" & tempCoilNo & "')" , dbFailOnError
90 DoCmd.Close acForm, Me.Name
'reopen the form showing the record with new Coil number
'this command could go into a different event to conform to your logic???
100 DoCmd.OpenForm "frmInpectMill", , , "CoilNumber ='" & tempCoilNo & "'"
110 End If
End Sub
I don't agree with that. If you remove the current value and leave the field you will get prompted. I'd only do the check if there is a value after the update, otherwise, do nothing.If Len(Me.Text312 & "") = 0 Then 20 MsgBox "You must enter a Coil Number", vbInfo
did you intend a message box? No one will see a debug.print70 Debug.Print " Coil " & tempCoilNo & " has been used previously.
I added a textbox text312 to frmInspectMill .................
They want to see the coil number control be blank so they don't accidentally forget to put the coil number of the coil on the mill.....
In my interpretation and approach - if this was a partial coil that had been used in part in another job, then that CoilNumber would already exist in tblCoils and that part of the form would be filled in. The idea was to keep the worker process constant (at least this small part) - whether the Coil is new or partially used, the worker enters the Coil tag number into the textbox. New Coil numbers are added automatically to tblCoils via the Insert SQL and the form opened to this new coil number, if an old coil the Coil number is found via the DCount and the form opens with that coil number.
I do not yet understand the related forms/tables/processes.
Private Sub Form_Load()
Dim rs As DAO.Recordset
If Not Trim(Me.OpenArgs & " ") = "" Then
'See if record exists
Set rs = Me.Recordset
'MsgBox Me.OpenArgs
rs.FindFirst "InspectionEvent_FK = " & CLng(Me.OpenArgs)
If rs.NoMatch Then 'it does not exist so you need to create it
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
Me.InspectionEvent_FK = Me.OpenArgs
End If
End If
End Sub
Because of Covid-19 I'm in personal isolation, so do have some time for forums and TV.
Yes. very well. Thank you.Do you follow the logic in the text312_AfterUpdate code I provided?
No. The coil number ID needs to be added to tblInspectMill because that is where all of the specific and unique data is recorded for unique and specific mill inspections. tblInspectionEvent is only an umbrella table for recording Date, JobNumber (which houses a host of data), inspector and operator names.When the worker types a TabNumber into text312, if it is a new coil number, I'd add a new record in tblCoil, but it seems I should also add a new record in tblInspectionEvent. Is that correct?
. No. The coil number ID (which should be autonumber - and is now) - not the coil number itself - should be recorded in tblInspectMill.If it is an exiting coil number, do you add a new record for this Coil, this Job in tblInspectionEvent ??
Long story - and I apologize for THAT confusion - late yesterday I was playing with making the coil number itself the primary key as they are all unique and I forgot to change back to having an autonumber ID field (CoilNumber_PK). I corrected that in the attached db. I am sorry.Is there a reason that you did not use an autonumber on tblCoils?
You can just ignore tblCoilChanges at the moment. Primarily because I don't think it is going to exist later. For normalizing and general real world workflow reasons, I believe it makes more sense to collect that data on frmLineStop and record it in tblLineStop.What exactly is tblCoilChanges and where does it fit?
If it is an exiting coil number, do you add a new record for this Coil, this Job in tblInspectionEvent ??
Where this is at is pretty much exactly what I said to do in post 13 where I said to use an unbound textbox for this. I have to wonder why it took so many posts to get to what is really a simple task and solution.
I question the relationships (solely based on the comments because I have not looked at any file) where you have a table for coils yet you only want to add a new coil number to an inspection table. As the seer says "I see more trouble in your future.".