Hi - I have a couple of questions.. any response is appreciated!
First, I am accessing an Access 97 database with VB 6.0. I should first tell you that I;m currently running Access 2000 but since there was too big an issue making it work with VB 6.0 in Access 2000, I'm pressed for time so I'm working with it in its 97 version.
The first thing I have a problem with is that I have an add hoc select statement form and when there are no results, it gives me a VB error, "No Records Found", then you have to end the whole program. How can I bypass this and just have a message box indicating this to the user?
The second problem I'm having is that I cannot get an add hoc Insert statement to work, here's some of my code for that:
ElseIf (cmbBeg.Text = "INSERT"
Then
SQL = "insert into " & cmbInsertI.Text
SQL = SQL & " (EmpID, EmpName, BirthDate, JobID, PayRate)"
SQL = SQL & " values (" & txtInsertEmpID.Text & ", " & DBTextFmt(txtInsertEmpName.Text)
SQL = SQL & ", " & CStr(DBDateFmt(txtInsertBirth.Text)) & ", " & txtInsertJobID.Text
SQL = SQL & ", " & txtInsertPay.Text & "
"
Set fEmpRS = fEmpDB.OpenRecordset(SQL)
Call OpenResults
End If
The error I get is: Run-time error '3219' Invalid operation.
The SQL ends up being:
insert into Employee (EmpID, EmpName, BirthDate, JobID, PayRate) values (100, 'John Doe', #04/04/1977#, 2, 19.00)
what's wrong with this where I keep getting this error?
again, ANY help is appreciated, I'm pressed for time!
thanks!!
First, I am accessing an Access 97 database with VB 6.0. I should first tell you that I;m currently running Access 2000 but since there was too big an issue making it work with VB 6.0 in Access 2000, I'm pressed for time so I'm working with it in its 97 version.
The first thing I have a problem with is that I have an add hoc select statement form and when there are no results, it gives me a VB error, "No Records Found", then you have to end the whole program. How can I bypass this and just have a message box indicating this to the user?
The second problem I'm having is that I cannot get an add hoc Insert statement to work, here's some of my code for that:
ElseIf (cmbBeg.Text = "INSERT"
SQL = "insert into " & cmbInsertI.Text
SQL = SQL & " (EmpID, EmpName, BirthDate, JobID, PayRate)"
SQL = SQL & " values (" & txtInsertEmpID.Text & ", " & DBTextFmt(txtInsertEmpName.Text)
SQL = SQL & ", " & CStr(DBDateFmt(txtInsertBirth.Text)) & ", " & txtInsertJobID.Text
SQL = SQL & ", " & txtInsertPay.Text & "
Set fEmpRS = fEmpDB.OpenRecordset(SQL)
Call OpenResults
End If
The error I get is: Run-time error '3219' Invalid operation.
The SQL ends up being:
insert into Employee (EmpID, EmpName, BirthDate, JobID, PayRate) values (100, 'John Doe', #04/04/1977#, 2, 19.00)
what's wrong with this where I keep getting this error?
again, ANY help is appreciated, I'm pressed for time!
thanks!!