Drawing question? (1 Viewer)

Dundee

New member
Local time
Today, 03:12
Joined
Mar 8, 2020
Messages
14
Hi Guys,

Good Day!

you guys don't mind if i ask more silly questions right. :giggle: ..
i'm try to pass this argument .. my code can't validate, if it is a drawing or not, its just saying all is not a drawing .. some thing like proceed the filter if it contains Document type drawings.

Dim DocRefNo As String
Dim stfilter As String

If Me.DocumentType.Value <> "*DWG*" Or Me.DocumentType.Value <> "*SDW*" Or Me.DocumentType.Value <> "*ASB*" Then
MsgBox "This Submission is not a Drawing" & vbCr & vbCr & "You can only search drawing on this register", vbInformation, ""

Else
stfilter = stfilter & "([SubmittalRefNo] LIKE '*" & Me.SubmittalSearchBx & "*')"
Forms("SubmittalDrawingHistory").Form.Filter = stfilter
Forms("Drawings").Form.Filter = stfilter
Forms("SubmittalDrawingHistory").Form.FilterOn = True
Forms("Drawings").Form.FilterOn = True
End If
 

Attachments

  • Screen Shot.PNG
    Screen Shot.PNG
    107.5 KB · Views: 80
Last edited by a moderator:

jdraw

Super Moderator
Staff member
Local time
Yesterday, 20:12
Joined
Jan 23, 2006
Messages
15,378
Please provide a description of your requirement in simple, plain English. Readers need some background/context in order to understand what you are dealing with and what you expect achieve.
Trying to respond without knowing the environment nor the terminology (drawing register, submittal..).
Providing examples of what you have and what you need can often improve communications and get you focused responses.
Do you really have values such as "*DWG*" and "*SDW*" in your application?
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 20:12
Joined
May 21, 2018
Messages
8,527
You need a
NOT LIKE "'*Text*'"
not a
<> "*Text*'"

Guarntee none of your types are = '*Text*' that would mean you really have "*DWG*" as Jdraw is pointing out.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:12
Joined
Oct 29, 2018
Messages
21,467
Hi. Just an observation... If you can only search drawings in "this register," then why even have the other document types in the dropdown? The user should not be able to select anything but DWG.
 

Dundee

New member
Local time
Today, 03:12
Joined
Mar 8, 2020
Messages
14
Please provide a description of your requirement in simple, plain English. Readers need some background/context in order to understand what you are dealing with and what you expect achieve.
Trying to respond without knowing the environment nor the terminology (drawing register, submittal..).
Providing examples of what you have and what you need can often improve communications and get you focused responses.
Do you really have values such as "*DWG*" and "*SDW*" in your application?

Hi Guys,

Actually my problem is Drawing Register Form and Submittal Form are link to one table which is Submittal table. and the DocumentType Field
Contains not only DWG SDW Code But More like CAL, MES, ITP.. Etc, in short it is mixed with other documents & Drawings. so i created an open event that will Filter Drawings only in this Drawing Form. now i created a search form, that base on a submittalRefNo you can check drawing or other documents.this form should not Filter anything other than drawing.

Problem No. 1 . - if drawings, proceed filtering base on the current record on DocumentRefNo. i tried the following approach below . no luck..
Value? String ? :unsure:.. thanks also to Mr. DBguy i did not notice that.. . am new to access by the way and i started liking it.

Dim stfilter As String

If Me.DocumentType.Value & " LIKE '*DWG*" Or Me.DocumentType.Value & " LIKE '*SDW*" Or Me.DocumentType.Value & " LIKE '*ASB*" Then
MsgBox "This Submission is not a Drawing" & vbCr & vbCr & "You can only search drawing on this register", vbInformation, ""

Else

stfilter = stfilter & "([DocumentRefNo] LIKE '*" & Me.DocumentrefNo & "*')"
Forms("SubmittalDrawingHistory").Form.Filter = stfilter
Forms("Drawings").Form.Filter = stfilter
Forms("SubmittalDrawingHistory").Form.FilterOn = True
Forms("Drawings").Form.FilterOn = True

End If
 

Attachments

  • Screen Shot.PNG
    Screen Shot.PNG
    98.3 KB · Views: 86

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 19:12
Joined
Feb 28, 2001
Messages
27,167
The DB guy is helping you some, but I'll make a suggestion for you. If Me.DocumentType.Value refers to the value in a textbox or combo box or list box on your form, then .Value is not needed. That is because for ALL Access form controls that have a .Value property at all, it is the default value. You can omit typing .Value because Access assumes that .Value is what you want when you reference that item. This is only true for items that have .Value as a property but that is a lot of the controls you are most likely to use.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 01:12
Joined
Jul 9, 2003
Messages
16,280
You can omit typing .Value because Access assumes that .Value is what you want when you reference that item.

There are a couple of exceptions which you need to be aware of:-


For some strange reason, in certain circumstances MS Access assumes it's a control and tries to assign a control instead of the value of the control.
 

Micron

AWF VIP
Local time
Yesterday, 20:12
Joined
Oct 20, 2018
Messages
3,478
For some strange reason, in certain circumstances MS Access assumes it's a control
I interpret your blog comments are referring to when a form control value is being assigned to a variable. I can only imagine this happening where the variable is not properly declared and typed (and I don't mean keyboarding). I have never had this issue, and never use Value unless multi value fields are involved. Even then, that's not in any db I've created.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 01:12
Joined
Jul 9, 2003
Messages
16,280
I interpret your blog comments are referring to when a form control value is being assigned to a variable.

From memory, the particular variable in question was a tempvar created by the conversion routine for converting a macro into VBA.

As I said in my blog I haven't studied this, I am just gathering information. I seem to recall that a tempvar is a string variable.

More details on the problem occuring when converting a macro to VBA here:-


With a 2:31min YouTube video....
 

Dundee

New member
Local time
Today, 03:12
Joined
Mar 8, 2020
Messages
14
Hi Guys

Thank for the Tips. Controls is the key ..

i finally make it work..

Private Sub SubmittalSearchBtn_Click()


If Len(Me.SubmittalSearchBx) = 0 Or IsNull(Me.SubmittalSearchBx) = True Then
MsgBox "Please Input and Search submittal number First"
Else

Dim stfilter As String
stfilter = stfilter & "([SubmittalRefNo] LIKE '*" & Me.SubmittalSearchBx & "*' and [DocumentType] LIKE '*" & Me.TxtDocumentTypeCode & "*')"
Forms("SubmittalDrawingHistory").Form.Filter = stfilter
Forms("Drawings").Form.Filter = stfilter
Forms("Drawings").Form.FilterOn = True
Forms("SubmittalDrawingHistory").Form.FilterOn = True

If Me.Recordset.RecordCount = 0 Then
MsgBox ("This submittal number is not a drawing ! Kindly check this document in submittal Register"), vbOKOnly, ""
End If
End If

End Sub
 

Attachments

  • Screen Shot 1.PNG
    Screen Shot 1.PNG
    66.1 KB · Views: 80
  • Screen Shot 2.PNG
    Screen Shot 2.PNG
    204.5 KB · Views: 80

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:12
Joined
Oct 29, 2018
Messages
21,467
Hi. Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom