mycotropic
Technical User
Hi!
I KNOW that this is very simple somehow;
I have a data entry switchboard that alows users to select an ID using a combo box, then, once they have an ID, select which data they want to enter; choose a form. If the ID in the combo box is already in the table that that form is conected to, the form is opened to that record. If the ID is NOT already in the table it opens to a blank record and they have to type in the ID again.
I am doing goign to the selected record with this code(where 'shelf' is a place that i store the combo boxs' slected value);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub cmdgotoclinicallab2_Click()
On Error GoTo Err_cmdgotoclinicallab2_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Fclinicallab"
stLinkCriteria = "[VisitNumber]=" & "'" & Me![shelf] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdgotoclinicallab2_Click:
Exit Sub
Err_cmdgotoclinicallab2_Click:
MsgBox Err.Description
Resume Exit_cmdgotoclinicallab2_Click
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My first qestion is; Is this the most efficient way to do what I am trying to do?
My second question is; How do I get an ID that is selected in the combo box but not in the table that the user selects to be passed there as a new row???? "Man is the cheapest computer we can put into a spacecraft and the only one we can mass-produce with unskilled labor." Werner von Braun
I KNOW that this is very simple somehow;
I have a data entry switchboard that alows users to select an ID using a combo box, then, once they have an ID, select which data they want to enter; choose a form. If the ID in the combo box is already in the table that that form is conected to, the form is opened to that record. If the ID is NOT already in the table it opens to a blank record and they have to type in the ID again.
I am doing goign to the selected record with this code(where 'shelf' is a place that i store the combo boxs' slected value);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub cmdgotoclinicallab2_Click()
On Error GoTo Err_cmdgotoclinicallab2_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Fclinicallab"
stLinkCriteria = "[VisitNumber]=" & "'" & Me![shelf] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdgotoclinicallab2_Click:
Exit Sub
Err_cmdgotoclinicallab2_Click:
MsgBox Err.Description
Resume Exit_cmdgotoclinicallab2_Click
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My first qestion is; Is this the most efficient way to do what I am trying to do?
My second question is; How do I get an ID that is selected in the combo box but not in the table that the user selects to be passed there as a new row???? "Man is the cheapest computer we can put into a spacecraft and the only one we can mass-produce with unskilled labor." Werner von Braun