Data input to check and open second form

Cirrostratus

Registered User.
Local time
Today, 06:16
Joined
May 16, 2013
Messages
29
Help!

I have a form called frmStartTimeEntry where a user inputs data using a barcode scanner. In this form there is a field called Part_No where after a value is inserted, I'd like the form to check if table_lines_per_part includes this part. If not found, then I'd like the form to open another form called frmLinesPerPart where the form would pull the same Part_No inserted in the previous form to fill in the Part_No field (which is hidden) and then the user would type in a qty for the LinesPerOrder. A user would then click a button btnOk to append this new record to table_lines_per_part and be returned to the frmStartTimeEntry to continue filling out the rest of the form.

This is the idea I have but I don't know how to code the part where the form checks after update if the part_no exists in the other table, nor how to capture the part_no to the other form and then append both the part_no and the lines per part to the other table.

Any feedback or help would be fantastic! ::confused:

Thanks!!
 
Ok,

I've been able to sort out most of the problems, the issue is with the dlookup. After I've read the Part_No field in the frmStartTimeEntry, it should check the table_lines_per_part for this part and if not found then direct to another form where the user can enter the missing information. Unfortunately, I cant get the dlookup to find this value. This is the code I have:

Code:
Private Sub Part_No_AfterUpdate()
Dim PartNo As String
PartNo = [Part_No]
If PartNo = DLookup("Part_No", "table_lines_per_part", "Criteria= 'string'") Then
Lot_Size.SetFocus
Else
DoCmd.OpenForm "frmLinesPerPart"
End If
End Sub

I'm probably way off but if someone could please push me in the right direction, I'd be super appreciative! Thanks!
 
Ok,

I got it to work using:

Code:
Private Sub Part_No_AfterUpdate()
    If IsNull(DLookup("Part_No", "table_lines_per_part", "Part_No = '" & [Forms]![frmStartTimeEntry]![Part_No] & "'")) Then
    DoCmd.OpenForm "frmLinesPerPart"
    Else
    Lot_Size.SetFocus
    End If
End Sub

hope this helps someone else in the same predicament..
 

Users who are viewing this thread

Back
Top Bottom