I have a form with a subform that I am trying to get 2 fields of the subform filled with data from the user before the form will allow a new record to be entered or before the form closes. I don't know much about SQL and something is obviously wrong with this piece. When I try to run it, a message pops up saying "Object doesn't support this property or method"
Any thoughts? Thanks.
Private Sub NewCow_Click()
On Error GoTo Err_NewCow_Click
Dim stDocName As String
Dim VarItem As Variant
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strCowLocation As String
Dim strDateMovedTo As String
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Set db = CurrentDb()
strDateMovedTo = " " & Me!frmsbCowLocationsEntry.DateMovedTo
strCowLocation = " " & Me!frmsbCowLocationsEntry.CowLocation
If Trim(strDateMovedTo) = "" Then
MsgBox "You Must Enter A Move Date To Continue!"
If Trim(strCowLocation) = "" Then
MsgBox "You Must Enter A Cow Location To Continue!"
DoCmd.GoToRecord , , acNewRec
1 . Dim strSQL As String isnt used
2 . can u stop the code with a F9 on the line Private Sub NewCow_Click()
then walk thru the code with F8 to see where u get the err (if u cant solve it, then report back )
3. i see the following :
if x then
if x then
do it like this
If x Then
ElseIf x Then