Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time Error '3024': when making a selection on a combo box

Status
Not open for further replies.

pryest

Programmer
Dec 26, 2006
24
0
0
US
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
 
You may want to take at your sql statement.

SQL = "SELECT City, St, PrjTyp " & _
"FROM lnk.stores " & _
"WHERE ([StoSeqNum] = '" & Me![Combo11] & "');"

You are specifically stating that you are wanting to use the Stores table in the "lnk" database.

Assuming your current directory is "c:\data" access will try to open lnk.mdb.

I hope this helps a bit.

Lt
 
DOH! Thanks LtLeary. That was it. I had a . when it should have been a _ . Now I feel silly. Racked my brain yesterday afternoon over a typo. It is working just fine now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top