Hey guys,
I am hoping you can offer a solution to this. I have a form that is pulling values based on a selection in a combo box. The values are then stored in a new table. The code I am useing in the AfterUpdate is this.
Private Sub Combo11_AfterUpdate()
Dim db As DAO.Database, rst As DAO.Recordset, SQL As String
Set db = CurrentDb
SQL = "SELECT City, St, PrjTyp " & _
"FROM lnk.stores " & _
"WHERE ([StoSeqNum] = '" & Me![Combo11] & "');"
Set rst = db.OpenRecordset(SQL, dbOpenDynaset)
If rst.BOF Then
MsgBox "Location Not Found!"
Else
Me!City = rst!City
Me!St = rst!St
Me!PrjTyp = rst!PrjTyp
End If
Set rst = Nothing
Set db = Nothing
End Sub
When you select the StoSeqNum you want the form should fill in the City, St, and PrjTyp. The form is bound to the new table where the values will be stored. I have this working on another form with no problems. I can't figure out why I am getting the Run-Time error '3024' Could not find file c:\Data\lnk.mdb and I am not sure why it is looking for that link.mdb anyways. When I debug the line Set rst = db.OpenRecordset(SQL, dbOpenDynaset) is highlighted. Can anyone offer any ideas on this. Thanks a ton.
Mike
I am hoping you can offer a solution to this. I have a form that is pulling values based on a selection in a combo box. The values are then stored in a new table. The code I am useing in the AfterUpdate is this.
Private Sub Combo11_AfterUpdate()
Dim db As DAO.Database, rst As DAO.Recordset, SQL As String
Set db = CurrentDb
SQL = "SELECT City, St, PrjTyp " & _
"FROM lnk.stores " & _
"WHERE ([StoSeqNum] = '" & Me![Combo11] & "');"
Set rst = db.OpenRecordset(SQL, dbOpenDynaset)
If rst.BOF Then
MsgBox "Location Not Found!"
Else
Me!City = rst!City
Me!St = rst!St
Me!PrjTyp = rst!PrjTyp
End If
Set rst = Nothing
Set db = Nothing
End Sub
When you select the StoSeqNum you want the form should fill in the City, St, and PrjTyp. The form is bound to the new table where the values will be stored. I have this working on another form with no problems. I can't figure out why I am getting the Run-Time error '3024' Could not find file c:\Data\lnk.mdb and I am not sure why it is looking for that link.mdb anyways. When I debug the line Set rst = db.OpenRecordset(SQL, dbOpenDynaset) is highlighted. Can anyone offer any ideas on this. Thanks a ton.
Mike