Hello,
I have a query that pulls data from a table based on user input. The data is stored in a temp table. After the user selects the data, could be from 1 to 5 or more, it puts it in a continuous form.
What I would like to have happen is before the data is loaded into the form. loop through each record and present the user with a Yes/No msgbox. Once it reaches the last record, exits out of the loop or "Do while" and goes to the form. The form will then populate the information of the data and change certain fields based on the "Yes/No" answer of the user.
I have this now based on just the click of a button on each continuous form. I am trying to elimate that and have it done before the data is populated into the form.
Button Code:
Dim answer As Integer
answer = MsgBox("Checking in " & Chr(34) & Me.Asset & Chr(34) & "?", vbYesNo + vbQuestion, "Equipment Check In or Out")
Select Case answer
Case vbYes
Me.DateIn = Date
Me.DateOut = ""
Me.Status = "2"
Me.EmployeeID = ""
If Me.Status = "2" Then
answer = MsgBox("Is this a Hot Spare PC?", vbYesNo, "HOT SPARE or NOT")
Select Case answer
Case vbYes
Me.Status = "5"
Case vbNo
Exit Sub
End Select
End If
Case vbNo
Me.DateOut = Date
Me.DateIn = ""
Me.Status = "1"
Me.C420_Location = ""
Exit Do
End Select
-------------------------
The field "Asset" (Me.Asset) is the key field they are using to search and
pull the specific record. I can get it to loop through the records with the
"Do until" but keeps looping and will not exit. I put the above on the "Forms
load" event. see below with Do and Loop statements added.
Dim answer As Integer
Do Until Me.Asset = Null
answer = MsgBox("Checking in " & Chr(34) & Me.Asset & Chr(34) & "?", vbYesNo + vbQuestion, "Equipment Check In or Out")
Select Case answer
Case vbYes
Me.DateIn = Date
Me.DateOut = ""
Me.Status = "2"
Me.EmployeeID = ""
If Me.Status = "2" Then
answer = MsgBox("Is this a Hot Spare PC?", vbYesNo, "HOT SPARE or NOT")
Select Case answer
Case vbYes
Me.Status = "5"
Case vbNo
Exit Sub
End Select
End If
Case vbNo
Me.DateOut = Date
Me.DateIn = ""
Me.Status = "1"
Me.C420_Location = ""
Exit Do
End Select
Loop
Any help would be appreciated.
I have a query that pulls data from a table based on user input. The data is stored in a temp table. After the user selects the data, could be from 1 to 5 or more, it puts it in a continuous form.
What I would like to have happen is before the data is loaded into the form. loop through each record and present the user with a Yes/No msgbox. Once it reaches the last record, exits out of the loop or "Do while" and goes to the form. The form will then populate the information of the data and change certain fields based on the "Yes/No" answer of the user.
I have this now based on just the click of a button on each continuous form. I am trying to elimate that and have it done before the data is populated into the form.
Button Code:
Dim answer As Integer
answer = MsgBox("Checking in " & Chr(34) & Me.Asset & Chr(34) & "?", vbYesNo + vbQuestion, "Equipment Check In or Out")
Select Case answer
Case vbYes
Me.DateIn = Date
Me.DateOut = ""
Me.Status = "2"
Me.EmployeeID = ""
If Me.Status = "2" Then
answer = MsgBox("Is this a Hot Spare PC?", vbYesNo, "HOT SPARE or NOT")
Select Case answer
Case vbYes
Me.Status = "5"
Case vbNo
Exit Sub
End Select
End If
Case vbNo
Me.DateOut = Date
Me.DateIn = ""
Me.Status = "1"
Me.C420_Location = ""
Exit Do
End Select
-------------------------
The field "Asset" (Me.Asset) is the key field they are using to search and
pull the specific record. I can get it to loop through the records with the
"Do until" but keeps looping and will not exit. I put the above on the "Forms
load" event. see below with Do and Loop statements added.
Dim answer As Integer
Do Until Me.Asset = Null
answer = MsgBox("Checking in " & Chr(34) & Me.Asset & Chr(34) & "?", vbYesNo + vbQuestion, "Equipment Check In or Out")
Select Case answer
Case vbYes
Me.DateIn = Date
Me.DateOut = ""
Me.Status = "2"
Me.EmployeeID = ""
If Me.Status = "2" Then
answer = MsgBox("Is this a Hot Spare PC?", vbYesNo, "HOT SPARE or NOT")
Select Case answer
Case vbYes
Me.Status = "5"
Case vbNo
Exit Sub
End Select
End If
Case vbNo
Me.DateOut = Date
Me.DateIn = ""
Me.Status = "1"
Me.C420_Location = ""
Exit Do
End Select
Loop
Any help would be appreciated.